forked from awailly/cis-ubuntu-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
46 lines (39 loc) · 1.61 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
---
language: python
python: "2.7"
#sudo: false
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
# 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
- cp /tmp/coveralls /tmp/firstcover
- >
ansible-playbook -i tests/inventory tests/playbook.yml --connection=local --sudo -e "pipelining=True" -t level1
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
after_success:
- COVERALLS_URL='https://coveralls.io/api/v1/jobs'
- curl -v -F 'json_file=@/tmp/firstcover' "$COVERALLS_URL"
- cat /tmp/firstcover