diff options
Diffstat (limited to 'tasks/postgres-common-postinstall.yml')
-rw-r--r-- | tasks/postgres-common-postinstall.yml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tasks/postgres-common-postinstall.yml b/tasks/postgres-common-postinstall.yml index 277fafd..715782c 100644 --- a/tasks/postgres-common-postinstall.yml +++ b/tasks/postgres-common-postinstall.yml | |||
@@ -15,13 +15,25 @@ | |||
15 | src: /var/lib/postgresql/.ssh/id_rsa.pub | 15 | src: /var/lib/postgresql/.ssh/id_rsa.pub |
16 | register: db_server_pub_key | 16 | register: db_server_pub_key |
17 | 17 | ||
18 | - name: Check if barman is installed on barman server | ||
19 | getent: | ||
20 | database: passwd | ||
21 | key: "barman" | ||
22 | delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}" | ||
23 | when: postgres_barman_server is defined | ||
24 | register: barman_user_exists | ||
25 | ignore_errors: true | ||
26 | changed_when: false | ||
27 | |||
18 | - name: Allow SSH access on barman server | 28 | - name: Allow SSH access on barman server |
19 | authorized_key: | 29 | authorized_key: |
20 | user: "barman" | 30 | user: "barman" |
21 | key: "{{ db_server_pub_key['content']|b64decode }}" | 31 | key: "{{ db_server_pub_key['content']|b64decode }}" |
22 | state: present | 32 | state: present |
23 | delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}" | 33 | delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}" |
24 | when: postgres_barman_server is defined | 34 | when: |
35 | - postgres_barman_server is defined | ||
36 | - barman_user_exists is succeeded | ||
25 | 37 | ||
26 | - name: Copy logrotate configuration for postgresql | 38 | - name: Copy logrotate configuration for postgresql |
27 | template: src=logrotate-postgresql-common.j2 dest=/etc/logrotate.d/postgresql-common owner=root group=root mode=0644 | 39 | template: src=logrotate-postgresql-common.j2 dest=/etc/logrotate.d/postgresql-common owner=root group=root mode=0644 |