diff options
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/postgres-cluster.yml | 13 | ||||
-rw-r--r-- | tasks/postgres-user.yml | 6 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tasks/postgres-cluster.yml b/tasks/postgres-cluster.yml index c052982..a8e96c1 100644 --- a/tasks/postgres-cluster.yml +++ b/tasks/postgres-cluster.yml | |||
@@ -5,6 +5,7 @@ | |||
5 | postgres_port: "{{ postgres_cluster.port }}" | 5 | postgres_port: "{{ postgres_cluster.port }}" |
6 | postgres_fsync_enabled: "{{ postgres_cluster.fsync_enabled }}" | 6 | postgres_fsync_enabled: "{{ postgres_cluster.fsync_enabled }}" |
7 | postgres_archive_enabled: "{{ postgres_cluster.archive_enabled }}" | 7 | postgres_archive_enabled: "{{ postgres_cluster.archive_enabled }}" |
8 | postgres_wal_level: "{{ postgres_cluster.wal_level|default('logical') }}" | ||
8 | postgres_max_replication_slots: "{{ postgres_cluster.max_replication_slots | default(10) }}" | 9 | postgres_max_replication_slots: "{{ postgres_cluster.max_replication_slots | default(10) }}" |
9 | postgres_extra_config: "{{ postgres_cluster.extra_config | default({}) }}" | 10 | postgres_extra_config: "{{ postgres_cluster.extra_config | default({}) }}" |
10 | barman_directory: "{{ postgres_cluster.barman_directory | default(None) }}" | 11 | barman_directory: "{{ postgres_cluster.barman_directory | default(None) }}" |
@@ -19,7 +20,7 @@ | |||
19 | apt: name=postgresql-{{ postgres_version }}-repack | 20 | apt: name=postgresql-{{ postgres_version }}-repack |
20 | when: | 21 | when: |
21 | - ansible_distribution_release != 'NA' | 22 | - ansible_distribution_release != 'NA' |
22 | - postgres_version in ['9.3', '9.4', '9.5', '9.6', '10', '11'] | 23 | - postgres_version in ['9.3', '9.4', '9.5', '9.6', '10', '11', '12'] |
23 | 24 | ||
24 | - name: Set initdb options | 25 | - name: Set initdb options |
25 | set_fact: postgres_initdb_option="{% if postgres_checksums %}--data-checksums{% endif %}" | 26 | set_fact: postgres_initdb_option="{% if postgres_checksums %}--data-checksums{% endif %}" |
@@ -82,9 +83,17 @@ | |||
82 | 83 | ||
83 | - name: Upload recovery.conf | 84 | - name: Upload recovery.conf |
84 | template: src=recovery.conf.j2 dest=/var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/recovery.conf owner=postgres group=postgres mode=0600 | 85 | template: src=recovery.conf.j2 dest=/var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/recovery.conf owner=postgres group=postgres mode=0600 |
85 | when: postgres_primary | 86 | when: postgres_primary and postgres_version is version('12', '<') |
86 | no_log: True | 87 | no_log: True |
87 | 88 | ||
89 | - name: Define secondary nodes as secondaries with corresponding signal files | ||
90 | file: | ||
91 | path: "{{ item }}" | ||
92 | state: touch | ||
93 | when: postgres_primary and postgres_version is version('12', '>=') | ||
94 | with_items: | ||
95 | - /var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/standby.signal | ||
96 | |||
88 | - name: Create log file | 97 | - name: Create log file |
89 | file: | 98 | file: |
90 | path={{ postgres_log_dir }}/postgresql-{{ postgres_version }}-{{ postgres_cluster_name }}.log | 99 | path={{ postgres_log_dir }}/postgresql-{{ postgres_version }}-{{ postgres_cluster_name }}.log |
diff --git a/tasks/postgres-user.yml b/tasks/postgres-user.yml index fcef9fc..000ea80 100644 --- a/tasks/postgres-user.yml +++ b/tasks/postgres-user.yml | |||
@@ -8,6 +8,12 @@ | |||
8 | check_mode: no | 8 | check_mode: no |
9 | changed_when: false | 9 | changed_when: false |
10 | 10 | ||
11 | - name: "Install required packages for 'postgres_user' ansible module" | ||
12 | apt: | ||
13 | name: | ||
14 | - libpq-dev | ||
15 | - python-psycopg2 | ||
16 | |||
11 | - name: Create PostgreSQL user | 17 | - name: Create PostgreSQL user |
12 | become: true | 18 | become: true |
13 | become_user: postgres | 19 | become_user: postgres |