]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blobdiff - test/main.yml
Merge pull request #6 from paulRbr/pg-extensions
[github/fretlink/ansible-postgresql-role.git] / test / main.yml
index 625819985ceff6bc51a2714e843851aeaf98987f..a4834be49be7be0699f8ada8a5dfefac60ba1242 100644 (file)
             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
           - 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:
       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