forked from kostiantyn-nemchenko/ansible-role-patroni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
29 lines (24 loc) · 1.55 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
sudo: required
language: python
env:
- DISTRIBUTION=ubuntu DISTRIBUTION_VERSION=16.04 ANSIBLE_VERSION=2.4 DCS=etcd
- DISTRIBUTION=centos DISTRIBUTION_VERSION=7 ANSIBLE_VERSION=2.4 DCS=etcd
install:
- pip install setuptools docker-compose ansible==${ANSIBLE_VERSION} --upgrade -q > /dev/null
- docker-compose -f tests/${DISTRIBUTION}-${DISTRIBUTION_VERSION}-compose.yml -f tests/${DCS}-compose.yml up -d
before_script:
- docker ps -a
- ansible-playbook -i tests/hosts tests/patroni.yml --syntax-check
script:
- travis_wait ansible-playbook -i tests/hosts tests/patroni.yml -Dvv --limit ${DISTRIBUTION}-${DISTRIBUTION_VERSION} --extra-vars patroni_dcs=${DCS}
after_script:
- sleep 10
- ansible -i tests/hosts ${DISTRIBUTION}-${DISTRIBUTION_VERSION} -a "journalctl -u patroni -n1000 --no-pager"
- ansible -i tests/hosts ${DISTRIBUTION}-${DISTRIBUTION_VERSION} -a "cat /var/log/patroni/patroni.log"
- ansible -i tests/hosts ${DISTRIBUTION}-${DISTRIBUTION_VERSION} -m shell -a "patronictl -c /etc/patroni/*.yml list"
- docker exec -t ${DISTRIBUTION}0 /bin/sh -c "patronictl -c /etc/patroni/*.yml failover --candidate ${DISTRIBUTION}1 --force || patronictl -c /etc/patroni/*.yml failover --candidate ${DISTRIBUTION}0 --force"
- sleep 15
- ansible -i tests/hosts ${DISTRIBUTION}-${DISTRIBUTION_VERSION} -m shell -a "patronictl -c /etc/patroni/*.yml list"
- docker-compose -f tests/${DISTRIBUTION}-${DISTRIBUTION_VERSION}-compose.yml -f tests/${DCS}-compose.yml down
- pip uninstall -y setuptools docker-compose ansible==${ANSIBLE_VERSION} -q > /dev/null