|
| 1 | +language: none |
| 2 | + |
| 3 | + |
| 4 | +build: |
| 5 | + pre_ci_boot: |
| 6 | + image_name: ansible/ansible |
| 7 | + image_tag: centos7 |
| 8 | + pull: true |
| 9 | + # we need a terminal or certain libc functions will fail |
| 10 | + options: "-ti" |
| 11 | + ci: |
| 12 | + # debug info |
| 13 | + - id |
| 14 | + - export |
| 15 | +# prepare the tools |
| 16 | + # this image is very bare and we need cron installed to test this role |
| 17 | + - yum -y install cronie crontabs |
| 18 | + # the Ansible package version is far too old (1.5.4) |
| 19 | + - yum -y install python-pip python-devel libffi-devel openssl-devel make gcc gcc-c++ screen |
| 20 | + - pip install ansible |
| 21 | + # TEMP: fix a bug using the cron module affecting stable |
| 22 | + - pip install --upgrade http://releases.ansible.com/ansible/ansible-2.2.0.0-0.2.rc2.tar.gz |
| 23 | + # check the installed version |
| 24 | + - ansible --version |
| 25 | + # ansible-lint is not packaged |
| 26 | + - pip install ansible-lint |
| 27 | + - pip install flake8 |
| 28 | +# verify the syntax of the playbook |
| 29 | + - ansible-lint tasks/main.yml |
| 30 | +# verify python script with pyflakes and pep8 |
| 31 | + - set -e ; for i in files/*.py; do flake8 $i ;done |
| 32 | +# setup the environment to run ansible |
| 33 | + - sed -i "s/<ROLE_NAME>/${SHIPPABLE_BUILD_DIR/*\//}/g" role_test.yml |
| 34 | + - echo -e "[defaults]\nroles_path = ../\n" > ansible.cfg |
| 35 | +# run a syntax check |
| 36 | + - ansible-playbook -i '127.0.0.1,' --syntax-check role_test.yml |
| 37 | +# check that the role can be run |
| 38 | + - ansible-playbook -i '127.0.0.1,' -c local -vvvv role_test.yml |
| 39 | +# verify idempotence ( ie, running a 2nd time shouldn't change anything ) |
| 40 | + - ansible-playbook -i '127.0.0.1,' -c local -vvvv role_test.yml | grep -q 'changed=0.*failed=0' |
| 41 | + |
| 42 | + |
| 43 | +integrations: |
| 44 | + notifications: |
| 45 | + - integrationName: email |
| 46 | + type: email |
| 47 | + on_success: never |
| 48 | + on_failure: never |
| 49 | + on_start: never |
| 50 | + on_pull_request: never |
| 51 | + |
0 commit comments