diff options
Diffstat (limited to 'tasks/main.yml')
-rw-r--r-- | tasks/main.yml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..ad6b5bb --- /dev/null +++ b/tasks/main.yml | |||
@@ -0,0 +1,80 @@ | |||
1 | --- | ||
2 | - include: postgres-common-preinstall.yml | ||
3 | tags: | ||
4 | - postgres | ||
5 | |||
6 | - include: postgres-log-directory.yml | ||
7 | tags: | ||
8 | - postgres | ||
9 | when: | ||
10 | - postgres_log_dir is defined and postgres_log_dir | ||
11 | |||
12 | - include: postgres-data-directory.yml | ||
13 | tags: | ||
14 | - postgres | ||
15 | when: postgres_data_dir is defined and postgres_data_dir | ||
16 | |||
17 | - name: fail if no clusters are defined | ||
18 | fail: | ||
19 | msg: "You probably forgot to define a PostgreSQL cluster on your host (`postgres_clusters` variable). Stopping run of the PostgreSQL role." | ||
20 | when: (postgres_clusters is not defined) or (postgres_clusters|length == 0) | ||
21 | |||
22 | - include: postgres-cluster.yml | ||
23 | postgres_version={{ item.version }} | ||
24 | postgres_cluster_name={{ item.name }} | ||
25 | postgres_port={{ item.port }} | ||
26 | postgres_fsync_enabled={{ item.fsync_enabled }} | ||
27 | postgres_archive_enabled={{ item.archive_enabled }} | ||
28 | postgres_max_replication_slots={{ item.max_replication_slots | default(10) }} | ||
29 | postgres_extra_config={{ item.extra_config | default({}) }} | ||
30 | barman_directory={{ item.barman_directory | default(None) }} | ||
31 | postgres_primary={{ item.primary | default(None) }} | ||
32 | postgres_checksums={{ item.checksums | default(True) }} | ||
33 | with_items: "{{ postgres_clusters }}" | ||
34 | tags: | ||
35 | - postgres | ||
36 | |||
37 | - include: postgres-common-postinstall.yml | ||
38 | tags: | ||
39 | - postgres | ||
40 | |||
41 | - include: postgres-user.yml | ||
42 | postgres_username={{ item.1.username }} | ||
43 | postgres_password={{ item.1.password }} | ||
44 | postgres_port={{ item.0.port }} | ||
45 | postgres_permissions={{ item.1.permissions | default('') }} | ||
46 | with_subelements: | ||
47 | - "{{ postgres_clusters }}" | ||
48 | - users | ||
49 | - skip_missing: true | ||
50 | tags: | ||
51 | - postgres | ||
52 | - postgres-users | ||
53 | |||
54 | - include: postgres-database.yml | ||
55 | postgres_dbname={{ item.1.dbname }} | ||
56 | postgres_owner={{ item.1.owner }} | ||
57 | postgres_port={{ item.0.port }} | ||
58 | with_subelements: | ||
59 | - "{{ postgres_clusters }}" | ||
60 | - databases | ||
61 | - skip_missing: true | ||
62 | tags: | ||
63 | - postgres | ||
64 | - postgres-databases | ||
65 | |||
66 | - include: postgres-pgupgrades.yml | ||
67 | postgres_dbname={{ item.dbname }} | ||
68 | postgres_pgbouncer_uri={{ item.pgbouncer_uri|default(None) }} | ||
69 | postgres_old_cluster_version={{ item.old_cluster_version }} | ||
70 | postgres_old_cluster_name={{ item.old_cluster_name }} | ||
71 | postgres_new_cluster_version={{ item.new_cluster_version }} | ||
72 | postgres_new_cluster_name={{ item.new_cluster_name }} | ||
73 | postgres_standby_server={{ item.standby_server }} | ||
74 | postgres_standby_old_cluster_name={{ item.standby_old_cluster_name|default(item.old_cluster_name) }} | ||
75 | postgres_standby_new_cluster_name={{ item.standby_new_cluster_name|default(item.new_cluster_name) }} | ||
76 | with_items: "{{ postgres_pgupgrades }}" | ||
77 | when: postgres_pgupgrades is defined | ||
78 | tags: | ||
79 | - postgres | ||
80 | - postgres-pgupgrades | ||