---
+dist: bionic
language: python
-python: "3.5"
+python: "3.8"
-# Use the new container infrastructure
-sudo: false
+# Test on all supported PG versions on both debian stretch and debian buster
+env:
+- POSTGRESQL_VERSION=9.5 DEBIAN_RELEASE=stretch
+- POSTGRESQL_VERSION=9.6 DEBIAN_RELEASE=stretch
+- POSTGRESQL_VERSION=10 DEBIAN_RELEASE=stretch
+- POSTGRESQL_VERSION=11 DEBIAN_RELEASE=stretch
+- POSTGRESQL_VERSION=12 DEBIAN_RELEASE=stretch
+- POSTGRESQL_VERSION=9.5 DEBIAN_RELEASE=buster
+- POSTGRESQL_VERSION=9.6 DEBIAN_RELEASE=buster
+- POSTGRESQL_VERSION=10 DEBIAN_RELEASE=buster
+- POSTGRESQL_VERSION=11 DEBIAN_RELEASE=buster
+- POSTGRESQL_VERSION=12 DEBIAN_RELEASE=buster
# Install pip
addons:
install:
# Install ansible
- - pip install ansible docker-py docker
+ - pip install -r test/requirements.txt
# Check ansible version
- ansible --version
- ansible-galaxy install -r test/requirements.yml -p test/roles/
# Basic role syntax check
- ansible-playbook test/main.yml -i test/hosts --syntax-check
# Run the tests
+ - ansible-playbook test/main.yml -i test/hosts -e "postgres_version=${POSTGRESQL_VERSION}" -e "debian_release=${DEBIAN_RELEASE}"
# FAILS - ansible-playbook test/main.yml -i test/hosts
# Even if Docker and docker-py module are present, the tests fail on Travis
# The error on Travis is:
- name: Bring up docker containers
hosts: localhost
vars: &common_vars
- postgres_version: 11
- postgres_barman_directory: 'test-postgres-11'
+ postgres_barman_directory: "test-postgres-{{ postgres_version }}"
postgres_barman_server: postgres_barman
barman_rsync_password: "secret_rsync"
barman_rsync_allowed_hosts: 172.17.0.0/24
range: 172.17.0.0/24
inventory:
- name: "{{ postgres_barman_server }}"
- image: "python:3.7-stretch"
+ image: "python:3.7-{{ debian_release }}"
- name: postgres_one
- image: "python:3.7-stretch"
+ image: "python:3.7-{{ debian_release }}"
links:
- "{{ postgres_barman_server }}"
- name: postgres_two
- image: "python:3.7-stretch"
+ image: "python:3.7-{{ debian_release }}"
links:
- "{{ postgres_barman_server }}"
- postgres_one
- name: postgres_three
- image: "python:3.7-stretch"
+ image: "python:3.7-{{ debian_release }}"
links:
- "{{ postgres_barman_server }}"
- postgres_one
roles:
- role: provision_docker
- provision_docker_inventory: "{{inventory}}"
- provision_docker_use_docker_connection: true
+ vars:
+ provision_docker_inventory: "{{inventory}}"
+ provision_docker_use_docker_connection: true
+ ansible_connection: local
+ ansible_python_interpreter: "{{ansible_playbook_python}}"
tasks:
- name: Group primary
add_host:
extensions:
- description: PostGis
apt_deps:
- - "postgresql-{{ postgres_version }}-postgis"
+ - "postgresql-{{ postgres_version }}-postgis-3"
names:
- postgis
- postgis_topology
hosts: primary:secondary
connection: docker
vars:
- postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
+ 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
+ - 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 }})"
+ - debug: msg="Running on host {{inventory_hostname}} ({{ hostvars[inventory_hostname].ansible_default_ipv4.address }})"
roles:
- { role: ansible-postgresql-role, tags: ['postgres'] }
tasks:
connection: docker
hosts: primary:secondary
vars:
- postgres_listen_addresses: "{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"
+ postgres_listen_addresses: ["{{ hostvars[inventory_hostname].ansible_default_ipv4.address }}"]
pre_tasks: *pre_tasks
roles:
- { role: ansible-postgresql-role, tags: ['postgres'] }