-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
27 lines (26 loc) · 1.16 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
---
language: python
python: "3.7"
before_install:
- sudo apt-get update -qq
install:
- pip install ansible-lint
- pip install flake8
- ( cd .. ; git clone https://gitlab.com/osas/ansible-role-tor.git tor)
script:
# verify the syntax of the playbook
- set -e ; for i in tasks/*.yml; do ansible-lint $i; done
# 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 --become --become-method sudo -vvvv role.yml
# verify idempotence ( ie, running a 2nd time shouldn't change anything )
- ansible-playbook -i '127.0.0.1,' -c local --become --become-method sudo -vvvv role.yml | grep -q 'changed=0.*failed=0'