From 4d626d5a5c05f4676c0a403929de775404f9e63c Mon Sep 17 00:00:00 2001 From: Paul B Date: Fri, 25 Jan 2019 11:55:41 +0100 Subject: feat(extensions): adds creation of extension on databases if needed --- tasks/postgres-common-postinstall.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tasks/postgres-common-postinstall.yml') 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 @@ src: /var/lib/postgresql/.ssh/id_rsa.pub register: db_server_pub_key +- name: Check if barman is installed on barman server + getent: + database: passwd + key: "barman" + delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}" + when: postgres_barman_server is defined + register: barman_user_exists + ignore_errors: true + changed_when: false + - name: Allow SSH access on barman server authorized_key: user: "barman" key: "{{ db_server_pub_key['content']|b64decode }}" state: present delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}" - when: postgres_barman_server is defined + when: + - postgres_barman_server is defined + - barman_user_exists is succeeded - name: Copy logrotate configuration for postgresql template: src=logrotate-postgresql-common.j2 dest=/etc/logrotate.d/postgresql-common owner=root group=root mode=0644 -- cgit v1.2.3