aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.yml')
-rw-r--r--test/main.yml41
1 files changed, 27 insertions, 14 deletions
diff --git a/test/main.yml b/test/main.yml
index 6258199..a4834be 100644
--- a/test/main.yml
+++ b/test/main.yml
@@ -49,12 +49,25 @@
49 archive_enabled: True 49 archive_enabled: True
50 barman_directory: "{{ postgres_barman_directory }}" 50 barman_directory: "{{ postgres_barman_directory }}"
51 users: 51 users:
52 - username: tester
53 password: tester
52 - username: barman 54 - username: barman
53 password: "secret_cocktail" 55 password: "secret_cocktail"
54 permissions: 'SUPERUSER' 56 permissions: 'SUPERUSER'
55 - username: replicator 57 - username: replicator
56 password: "secret_repli" 58 password: "secret_repli"
57 permissions: 'REPLICATION' 59 permissions: 'REPLICATION'
60 databases:
61 - dbname: test_database
62 owner: tester
63 extensions:
64 - description: PostGis
65 apt_deps:
66 - "postgresql-{{ postgres_version }}-postgis"
67 names:
68 - postgis
69 - postgis_topology
70 - btree_gist
58 71
59 with_items: 72 with_items:
60 - postgres_one 73 - postgres_one
@@ -104,18 +117,19 @@
104 - name: "{{ postgres_barman_directory }}" 117 - name: "{{ postgres_barman_directory }}"
105 description: 'Main database' 118 description: 'Main database'
106 primary_host: postgres_one 119 primary_host: postgres_one
107 primary_barman_password: "secret_cocktail" 120 postgres_barman_password: "secret_cocktail"
108 backup_method: rsync 121 backup_method: rsync
109 ansible_group: db-all 122 standby_hosts: "{{ groups['db-all'][1:] }}"
110 retention_policy: 'RECOVERY WINDOW OF 7 DAYS' 123 retention_policy: 'RECOVERY WINDOW OF 7 DAYS'
111 with_items: 124 with_items:
112 - postgres_barman 125 - postgres_barman
113 tags: provision_docker 126 tags: provision_docker
114 127
115- name: Test installing Barman role 128- name: Test installing Postgresql role
116 hosts: barman 129 hosts: primary:secondary
117 connection: docker 130 connection: docker
118 vars: {} 131 vars:
132 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
119 pre_tasks: &pre_tasks 133 pre_tasks: &pre_tasks
120 - name: "Build hosts file" 134 - name: "Build hosts file"
121 shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts' 135 shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts'
@@ -123,15 +137,6 @@
123 137
124 - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})" 138 - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})"
125 roles: 139 roles:
126 - { role: barman, tags: ['barman'] }
127
128- name: Test installing Postgresql role
129 hosts: primary:secondary
130 connection: docker
131 vars:
132 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
133 pre_tasks: *pre_tasks
134 roles:
135 - { role: ansible-postgresql-role, tags: ['postgres'] } 140 - { role: ansible-postgresql-role, tags: ['postgres'] }
136 tasks: 141 tasks:
137 - name: Start postgres cluster 142 - name: Start postgres cluster
@@ -144,6 +149,14 @@
144 command: psql --port=5432 --command='select NOW()' 149 command: psql --port=5432 --command='select NOW()'
145 150
146 151
152- name: Test installing Barman role
153 hosts: barman
154 connection: docker
155 vars: {}
156 pre_tasks: *pre_tasks
157 roles:
158 - { role: barman, tags: ['barman'] }
159
147- name: Test running Postgresql role when database is started 160- name: Test running Postgresql role when database is started
148 connection: docker 161 connection: docker
149 hosts: primary:secondary 162 hosts: primary:secondary