forked from awailly/cis-ubuntu-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
50 lines (42 loc) · 1.92 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
---
language: python
python: "2.7"
env:
- ANSIBLE_VERSION=1.9.1
- ANSIBLE_VERSION=2.0
notifications:
irc: "chat.freenode.net##cis-ansible"
before_install:
# Make sure everything's up to date. Not possible with sudo: false
- sudo apt-get update -qq
- sudo apt-get install aptitude
# Create hard to quote file for issue #13
- echo hello >> "hard'to\"quote$file"
- sudo chown 1234:4321 "hard'to\"quote$file"
# Copy specific configuration file to default/main/yml
- cp tests/travis_defaults.yml vars/main.yml
before_script:
- sudo ./tests/setup-tests.sh
install:
# Install Ansible.
- pip install ansible==$ANSIBLE_VERSION
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; echo 'callback_plugins = ./tests/callbacks/'; } >> ansible.cfg"
script:
# The -t level1 enable quicker verification, and the level2 enables postfix
# when installing AIDE. Thus it is not idempotent on the second launch
# (but ok on the third). It may be a good idea to invert the section order
# in the future.
- ansible-playbook -i tests/inventory tests/playbook.yml --syntax-check
- ansible-playbook -i tests/inventory tests/playbook.yml --connection=local --sudo -e "pipelining=True" -t level1
- if [ ${ANSIBLE_VERSION} = "1.9.1" ]; then cp /tmp/coveralls /tmp/firstcover; fi
- ansible-playbook -i tests/inventory tests/playbook.yml --connection=local --sudo -e "pipelining=True" -t level1 > /tmp/idempotence
- >
cat /tmp/idempotence
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && cat /tmp/idempotence && exit 1)
after_success:
- if [ ${ANSIBLE_VERSION} = "1.9.1" ]; then COVERALLS_URL='https://coveralls.io/api/v1/jobs'; fi
- if [ ${ANSIBLE_VERSION} = "1.9.1" ]; then curl -v -F 'json_file=@/tmp/firstcover' "$COVERALLS_URL"; fi
- if [ ${ANSIBLE_VERSION} = "1.9.1" ]; then cat /tmp/firstcover; fi