diff options
author | Paul B <paul+gh@bonaud.fr> | 2019-01-29 15:45:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-29 15:45:25 +0100 |
commit | 0c83dd00b4110d55b1602ca8d732a8cb414cfd0a (patch) | |
tree | 5191176c7f7226def631feb0f6cdc2a12045f0e4 /test | |
parent | 2bedf1bbf762903d955e4a76f674799a6acb2258 (diff) | |
parent | 7b241a44e602d70c97e9b9e5af4b600ff7eb3651 (diff) | |
download | ansible-postgresql-role-0c83dd00b4110d55b1602ca8d732a8cb414cfd0a.tar.gz ansible-postgresql-role-0c83dd00b4110d55b1602ca8d732a8cb414cfd0a.tar.zst ansible-postgresql-role-0c83dd00b4110d55b1602ca8d732a8cb414cfd0a.zip |
Merge pull request #6 from paulRbr/pg-extensions1.4.0
feat(extensions): adds creation of extension on databases if needed
Diffstat (limited to 'test')
-rw-r--r-- | test/main.yml | 41 | ||||
-rw-r--r-- | test/requirements.yml | 2 |
2 files changed, 28 insertions, 15 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 |
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 |