2 - name: Bring up docker containers
6 postgres_barman_directory: 'test-postgres-11'
7 postgres_barman_server: postgres_barman
8 barman_rsync_password: "secret_rsync"
9 barman_rsync_allowed_hosts: 172.17.0.0/24
10 postgres_allowed_hosts:
13 postgres_replication_hosts:
17 - name: "{{ postgres_barman_server }}"
18 image: "python:3.7-stretch"
20 image: "python:3.7-stretch"
22 - "{{ postgres_barman_server }}"
24 image: "python:3.7-stretch"
26 - "{{ postgres_barman_server }}"
28 - name: postgres_three
29 image: "python:3.7-stretch"
31 - "{{ postgres_barman_server }}"
34 - role: provision_docker
35 provision_docker_inventory: "{{inventory}}"
36 provision_docker_use_docker_connection: true
44 - version: "{{ postgres_version }}"
50 barman_directory: "{{ postgres_barman_directory }}"
53 password: "secret_cocktail"
54 permissions: 'SUPERUSER'
55 - username: replicator
56 password: "secret_repli"
57 permissions: 'REPLICATION'
61 tags: provision_docker
63 - name: Group secondaries
69 - version: "{{ postgres_version }}"
75 barman_directory: "{{ postgres_barman_directory }}"
79 restore_directory: "{{ postgres_barman_directory }}"
80 replication_user: "replicator"
81 replication_password: "secret_repli"
86 tags: provision_docker
96 tags: provision_docker
104 - name: "{{ postgres_barman_directory }}"
105 description: 'Main database'
106 primary_host: postgres_one
107 primary_barman_password: "secret_cocktail"
109 ansible_group: db-all
110 retention_policy: 'RECOVERY WINDOW OF 7 DAYS'
113 tags: provision_docker
115 - name: Test installing Barman role
119 pre_tasks: &pre_tasks
120 - name: "Build hosts file"
121 shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts'
122 when: hostvars[inventory_hostname].ansible_default_ipv4.address is defined
124 - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})"
126 - { role: barman, tags: ['barman'] }
128 - name: Test installing Postgresql role
129 hosts: primary:secondary
132 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
133 pre_tasks: *pre_tasks
135 - { role: ansible-postgresql-role, tags: ['postgres'] }
137 - name: Start postgres cluster
138 service: name=postgresql state=started
140 - name: Test connection to Postgres instances.
142 become_user: postgres
144 command: psql --port=5432 --command='select NOW()'
147 - name: Test running Postgresql role when database is started
149 hosts: primary:secondary
151 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
152 pre_tasks: *pre_tasks
154 - { role: ansible-postgresql-role, tags: ['postgres'] }