-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis.yml
26 lines (25 loc) · 1.02 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
---
language: python
python: "2.7"
before_install:
- sudo apt-get update -qq
install:
- pip install ansible-lint
- pip install flake8
script:
# verify the syntax of the playbook
- ansible-lint tasks/main.yml
# verify any shell script
# - set -e ; for i in files/*.sh; do bash -n $i ;done
# verify python script with pyflakes and pep8
# - set -e ; for i in files/*.py; do flake8 $i ;done
# setup the environment to run ansible
- "echo '---\n- hosts: 127.0.0.1\n remote_user: root\n roles:' > role.yml"
- echo " - ${TRAVIS_REPO_SLUG/*\//}" >> role.yml
- "echo '[defaults]\nroles_path = ../\n' > ansible.cfg"
# run a 2nd syntax check ( not sure if ansible-lint shouldn't already do that )
- ansible-playbook -i '127.0.0.1,' --syntax-check role.yml
# check that the role can be run
# - ansible-playbook -i '127.0.0.1,' -c local --sudo -vvvv role.yml
# verify idempotence ( ie, running a 2nd time shouldn't change anything )
# - ansible-playbook -i '127.0.0.1,' -c local --sudo -vvvv role.yml | grep -q 'changed=0.*failed=0'