forked from didried/ansible-virtualbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
54 lines (47 loc) · 1.63 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
51
52
53
54
---
sudo: required
dist: trusty
language: python
python:
- "2.7"
services:
- docker
env:
global:
- PATH="/usr/bin:$PATH"
before_install:
# Ansible doesn't play well with virtualenv
- deactivate
- sudo apt-get update -qq
- sudo apt-get install -y -o Dpkg::Options::="--force-confnew" docker-engine
install:
- sudo pip install docker-py
# software-properties-common for ubuntu 14.04
# python-software-properties for ubuntu 12.04
- sudo apt-get install -y sshpass software-properties-common python-software-properties
- sudo apt-add-repository -y ppa:ansible/ansible
- sudo apt-get update -qq
- sudo apt-get install -y ansible
- sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.7 /usr/bin/python
# install
- ansible-galaxy install -r tests/requirements.yml -p tests/roles/
script:
- >
sudo ansible all -i "127.0.0.1," -m
lineinfile -a "regexp=^#host_key_checking dest=/etc/ansible/ansible.cfg line='host_key_checking = False'" -c local
# Check the role/playbook's syntax.
- ansible-playbook -i tests/inventory tests/main.yml --syntax-check
# Run the role/playbook with ansible-playbook.
- >
ansible-playbook -i tests/inventory tests/main.yml
--connection=local --sudo
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/main.yml
--connection=local --sudo
| grep -q 'changed=[0].*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
notifications:
# notify ansible galaxy of test results
webhooks: https://galaxy.ansible.com/api/v1/notifications/