-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
59 lines (51 loc) · 2.26 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
language: python
python: "2.7"
before_install:
# Make sure everything's up to date.
- sudo apt-get update -qq
- sudo apt-get install -qq python-apt python-pycurl git python-pip
install:
# Install Ansible.
- pip install ansible
script:
- cd tests
# 1st: check syntax
- echo "***************************** SYNTAX CHECK test 1 (1) *****************************"
- ansible-playbook -i local.ini test1.yml --syntax-check
# 2nd: Make sure we run the entire playbook
- echo "***************************** RUN PLAY test 1 (2) *****************************"
- ansible-playbook -i local.ini test1.yml --sudo -vvvv
# 3rd: Make sure our playbook is idempotent
- echo "***************************** Idempotence test test 1 (3) *****************************"
- >
ansible-playbook -i local.ini test1.yml --sudo -vvvv | tee ansible_output
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# 1st: check syntax
- echo "***************************** SYNTAX CHECK test 2 (1) *****************************"
- ansible-playbook -i local.ini test2.yml --syntax-check
# 2nd: Make sure we run the entire playbook
- echo "***************************** RUN PLAY test 2 (2) *****************************"
- ansible-playbook -i local.ini test2.yml --sudo -vvvv
# 3rd: Make sure our playbook is idempotent
- echo "***************************** Idempotence test test 2 (3) *****************************"
- >
ansible-playbook -i local.ini test2.yml --sudo -vvvv | tee ansible_output
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
after_failure:
- echo -e "######IdepotanceLog #######"
- sudo cat ansible_output
- echo -e "######Syslog#######"
- sudo cat /var/log/syslog
- echo -e "######NerveLog#######"
- sudo cat /var/log/smartstack/nerve.log
- echo -e "######SerfLog#######"
- sudo cat /var/log/smartstack/serf.log
- echo -e "######SyanpaseLog#######"
- sudo cat /var/log/smartstack/synapse.log
- echo -e "######AnsibleFacts#######"
- ansible -i 127.0.0.1, -m setup all -c local