aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/postgres-common-postinstall.yml
diff options
context:
space:
mode:
authorPaul B <paul.bonaud@capitainetrain.com>2018-08-31 11:49:09 +0200
committerPaul B <paul.bonaud@capitainetrain.com>2018-08-31 12:00:24 +0200
commitd0bc90e08c29e881c388c6803ed9c49dff1f1776 (patch)
treee5f633a7461f3d339ef89758fc7bb3f1b91563d3 /tasks/postgres-common-postinstall.yml
downloadansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.gz
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.zst
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.zip
Initial commit open sourcing Postgresql Ansible role1.0.0
Diffstat (limited to 'tasks/postgres-common-postinstall.yml')
-rw-r--r--tasks/postgres-common-postinstall.yml46
1 files changed, 46 insertions, 0 deletions
diff --git a/tasks/postgres-common-postinstall.yml b/tasks/postgres-common-postinstall.yml
new file mode 100644
index 0000000..277fafd
--- /dev/null
+++ b/tasks/postgres-common-postinstall.yml
@@ -0,0 +1,46 @@
1- user: name=postgres append=yes groups=ssl-cert
2
3- name: Creates .ssh directory
4 file: path=/var/lib/postgresql/.ssh state=directory owner=postgres group=postgres mode=0700
5
6- name: Create postgres SSH key
7 command: ssh-keygen -b 4096 -f /var/lib/postgresql/.ssh/id_rsa -N "" -q
8 become: yes
9 become_user: postgres
10 become_method: su
11 args:
12 creates: /var/lib/postgresql/.ssh/id_rsa
13
14- slurp:
15 src: /var/lib/postgresql/.ssh/id_rsa.pub
16 register: db_server_pub_key
17
18- name: Allow SSH access on barman server
19 authorized_key:
20 user: "barman"
21 key: "{{ db_server_pub_key['content']|b64decode }}"
22 state: present
23 delegate_to: "{{ postgres_barman_server_public|default(postgres_barman_server) }}"
24 when: postgres_barman_server is defined
25
26- 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
28
29- name: Create /root/scripts needed directory
30 file: path=/root/scripts/ state=directory
31
32- name: Create pgbadger user
33 user: name=pgbadger home=/home/pgbadger
34 when: postgres_pgbadger_server is defined and postgres_pgbadger_server
35
36- name: Copy pbBadger script
37 template: src=pgBadger.sh.j2 dest=/root/scripts/pgBadger.sh owner=root group=root mode=0755
38 when: postgres_pgbadger_server is defined and postgres_pgbadger_server
39
40- name: Ensure dedicated log directory is owned by postgres
41 file: path={{ postgres_log_dir }} state=directory owner=postgres group=postgres
42 when: postgres_log_dir is defined and postgres_log_dir
43
44- name: Ensure dedicated data directory is owned by postgres
45 file: path={{ postgres_data_dir }} state=directory owner=postgres group=postgres
46 when: postgres_data_dir is defined and postgres_data_dir