forked from likg/ansible-role-csf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
66 lines (59 loc) · 2.67 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
55
56
57
58
59
60
61
62
63
64
65
66
---
dist: bionic
sudo: false
language: python
services: docker
cache: pip
addons:
apt:
packages:
- python-pip
env:
global:
- _ANSIBLE_CONNECTION=local
- _ANSIBLE_PLAYBOOK=tests/docker_playbook.yml
matrix:
- _ANSIBLE_CONNECTION=ssh _ANSIBLE_PLAYBOOK=tests/test.yml
_DOCKER_NAME=alpine _DOCKER_IMAGE=alpine
- _DOCKER_NAME=centos6 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:centos-6 _DOCKER_IMAGE_INIT=/sbin/init
- _DOCKER_NAME=centos7 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:centos-7 _DOCKER_IMAGE_INIT=/usr/lib/systemd/systemd
- _DOCKER_NAME=debian8 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:debian-8 _DOCKER_IMAGE_INIT=/lib/systemd/systemd
- _DOCKER_NAME=debian9 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:debian-9 _DOCKER_IMAGE_INIT=/lib/systemd/systemd
- _DOCKER_NAME=ubuntu16 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:ubuntu-16.04 _DOCKER_IMAGE_INIT=/lib/systemd/systemd
- _DOCKER_NAME=ubuntu18 _DOCKER_IMAGE=ansiblecheck/ansiblecheck:ubuntu-18.04 _DOCKER_IMAGE_INIT=/lib/systemd/systemd
matrix:
fast_finish: true
before_install:
- >
ssh-keygen -t rsa -C travis@localhost -q -P '' -f ~/.ssh/id_rsa ;
cat /home/travis/.ssh/id_rsa.pub >> /home/travis/.ssh/authorized_keys ;
printf 'Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null\n' > /home/travis/.ssh/config;
install:
# - travis_retry pip install git+git://github.com/ansible/ansible.git@devel
- travis_retry pip install --upgrade --upgrade-strategy=eager ansible ansible-lint
- travis_retry docker pull ${_DOCKER_IMAGE}
before_script:
- printf '[defaults]\nroles_path=../\nhost_key_checking = False\nretry_files_enabled = False\n\n[ssh_connection]\npipelining = True\n' > ansible.cfg
- printf 'localhost' > inventory
- sudo ln -s /bin/true /usr/sbin/sendmail
- ansible --version
script:
- ansible-lint -v ${_ANSIBLE_PLAYBOOK}
- >
ansible-playbook -i inventory ${_ANSIBLE_PLAYBOOK}
--connection=${_ANSIBLE_CONNECTION}
--extra-vars "DOCKER_NAME=${_DOCKER_NAME} DOCKER_IMAGE=${_DOCKER_IMAGE} DOCKER_IMAGE_INIT=${_DOCKER_IMAGE_INIT}"
--skip-tags "destroy"
-vv
- >
ANSIBLE_LOG_PATH=/tmp/idempotence.log
ansible-playbook -i inventory ${_ANSIBLE_PLAYBOOK}
--connection=${_ANSIBLE_CONNECTION}
--extra-vars "DOCKER_NAME=${_DOCKER_NAME} DOCKER_IMAGE=${_DOCKER_IMAGE} DOCKER_IMAGE_INIT=${_DOCKER_IMAGE_INIT}"
- >
awk '/PLAY RECAP/,/EOF/
{if (NF && $7 !~ "PLAY" && $10$11$12 !~ "changed=0unreachable=0failed=0" ) status=1 } END
{ print (status)? "Idempotence test: FAIL" : "Idempotence test: PASS"; exit status }'
/tmp/idempotence.log
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/