From dd54b74860fd9db85807619109b000b16b9bf52e Mon Sep 17 00:00:00 2001 From: Paul B Date: Fri, 25 Jan 2019 13:38:57 +0100 Subject: tests: adding a database creation with extensions --- test/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/main.yml b/test/main.yml index 6258199..bc9d27c 100644 --- a/test/main.yml +++ b/test/main.yml @@ -49,12 +49,25 @@ archive_enabled: True barman_directory: "{{ postgres_barman_directory }}" users: + - username: tester + password: tester - username: barman password: "secret_cocktail" permissions: 'SUPERUSER' - username: replicator password: "secret_repli" permissions: 'REPLICATION' + databases: + - dbname: test_database + owner: tester + extensions: + - description: PostGis + apt_deps: + - "postgresql-{{ postgres_version }}-postgis" + names: + - postgis + - postgis_topology + - btree_gist with_items: - postgres_one -- cgit v1.2.3 From 6037b0f8ec62eaad728ee617418968ea324eb44c Mon Sep 17 00:00:00 2001 From: Paul B Date: Mon, 28 Jan 2019 16:03:15 +0100 Subject: tests: fix test playbook due to barman <-> postgres circle dependencies --- test/main.yml | 28 ++++++++++++++-------------- test/requirements.yml | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/main.yml b/test/main.yml index bc9d27c..a4834be 100644 --- a/test/main.yml +++ b/test/main.yml @@ -117,33 +117,25 @@ - name: "{{ postgres_barman_directory }}" description: 'Main database' primary_host: postgres_one - primary_barman_password: "secret_cocktail" + postgres_barman_password: "secret_cocktail" backup_method: rsync - ansible_group: db-all + standby_hosts: "{{ groups['db-all'][1:] }}" retention_policy: 'RECOVERY WINDOW OF 7 DAYS' with_items: - postgres_barman tags: provision_docker -- name: Test installing Barman role - hosts: barman +- name: Test installing Postgresql role + hosts: primary:secondary connection: docker - vars: {} + vars: + postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}" pre_tasks: &pre_tasks - name: "Build hosts file" shell: 'echo "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }} {{inventory_hostname}}" >> /etc/hosts' when: hostvars[inventory_hostname].ansible_default_ipv4.address is defined - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})" - roles: - - { role: barman, tags: ['barman'] } - -- name: Test installing Postgresql role - hosts: primary:secondary - connection: docker - vars: - postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}" - pre_tasks: *pre_tasks roles: - { role: ansible-postgresql-role, tags: ['postgres'] } tasks: @@ -157,6 +149,14 @@ command: psql --port=5432 --command='select NOW()' +- name: Test installing Barman role + hosts: barman + connection: docker + vars: {} + pre_tasks: *pre_tasks + roles: + - { role: barman, tags: ['barman'] } + - name: Test running Postgresql role when database is started connection: docker 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 @@ version: 7a6243dfcf69f9d262877eca487bc14b62ba6960 - src: trainline-eu.ansible_barman_role name: barman - version: 1.0.0 + version: 1.1.0 -- cgit v1.2.3