aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorPaul B <paul@bonaud.fr>2019-01-28 16:03:15 +0100
committerPaul B <paul@bonaud.fr>2019-01-29 11:42:41 +0100
commit6037b0f8ec62eaad728ee617418968ea324eb44c (patch)
tree0a11b837ad8739326ba923793da3124d37773afd /test
parentdd54b74860fd9db85807619109b000b16b9bf52e (diff)
downloadansible-postgresql-role-6037b0f8ec62eaad728ee617418968ea324eb44c.tar.gz
ansible-postgresql-role-6037b0f8ec62eaad728ee617418968ea324eb44c.tar.zst
ansible-postgresql-role-6037b0f8ec62eaad728ee617418968ea324eb44c.zip
tests: fix test playbook due to barman <-> postgres circle dependencies
Diffstat (limited to 'test')
-rw-r--r--test/main.yml28
-rw-r--r--test/requirements.yml2
2 files changed, 15 insertions, 15 deletions
diff --git a/test/main.yml b/test/main.yml
index bc9d27c..a4834be 100644
--- a/test/main.yml
+++ b/test/main.yml
@@ -117,18 +117,19 @@
117 - name: "{{ postgres_barman_directory }}" 117 - name: "{{ postgres_barman_directory }}"
118 description: 'Main database' 118 description: 'Main database'
119 primary_host: postgres_one 119 primary_host: postgres_one
120 primary_barman_password: "secret_cocktail" 120 postgres_barman_password: "secret_cocktail"
121 backup_method: rsync 121 backup_method: rsync
122 ansible_group: db-all 122 standby_hosts: "{{ groups['db-all'][1:] }}"
123 retention_policy: 'RECOVERY WINDOW OF 7 DAYS' 123 retention_policy: 'RECOVERY WINDOW OF 7 DAYS'
124 with_items: 124 with_items:
125 - postgres_barman 125 - postgres_barman
126 tags: provision_docker 126 tags: provision_docker
127 127
128- name: Test installing Barman role 128- name: Test installing Postgresql role
129 hosts: barman 129 hosts: primary:secondary
130 connection: docker 130 connection: docker
131 vars: {} 131 vars:
132 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
132 pre_tasks: &pre_tasks 133 pre_tasks: &pre_tasks
133 - name: "Build hosts file" 134 - name: "Build hosts file"
134 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'
@@ -136,15 +137,6 @@
136 137
137 - 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 }})"
138 roles: 139 roles:
139 - { role: barman, tags: ['barman'] }
140
141- name: Test installing Postgresql role
142 hosts: primary:secondary
143 connection: docker
144 vars:
145 postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
146 pre_tasks: *pre_tasks
147 roles:
148 - { role: ansible-postgresql-role, tags: ['postgres'] } 140 - { role: ansible-postgresql-role, tags: ['postgres'] }
149 tasks: 141 tasks:
150 - name: Start postgres cluster 142 - name: Start postgres cluster
@@ -157,6 +149,14 @@
157 command: psql --port=5432 --command='select NOW()' 149 command: psql --port=5432 --command='select NOW()'
158 150
159 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
160- name: Test running Postgresql role when database is started 160- name: Test running Postgresql role when database is started
161 connection: docker 161 connection: docker
162 hosts: primary:secondary 162 hosts: primary:secondary
diff --git a/test/requirements.yml b/test/requirements.yml
index 4c72838..f9d7099 100644
--- a/test/requirements.yml
+++ b/test/requirements.yml
@@ -3,4 +3,4 @@
3 version: 7a6243dfcf69f9d262877eca487bc14b62ba6960 3 version: 7a6243dfcf69f9d262877eca487bc14b62ba6960
4- src: trainline-eu.ansible_barman_role 4- src: trainline-eu.ansible_barman_role
5 name: barman 5 name: barman
6 version: 1.0.0 6 version: 1.1.0