-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
89 lines (75 loc) · 1.9 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
language: python
cache: pip
matrix:
include:
- os: linux
dist: xenial
python: "3.8"
sudo: required
- os: linux
dist: bionic
python: "3.8"
sudo: required
- os: linux
dist: focal
python: "3.8"
sudo: required
# Install ansible
addons:
apt:
packages:
- python3-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# uninstall docker
- dpkg -l|grep docker
- sudo apt-get update
- sudo apt-get purge docker-ce
script:
# check docker is not installed
- >
docker ps
&& (echo 'docker installed' && exit 1)
|| (echo 'docker not installed' && exit 0)
# run role
- ansible-playbook tests/docker_20.10.2.yml -i tests/inventory
# check docker is installed
- docker --version
- >
docker --version | grep 20.10.2
&& (echo 'docker installed' && exit 0)
|| (echo 'docker not installed' && exit 1)
# test role idempotence
- idempotence=$(mktemp)
- ansible-playbook tests/docker_20.10.2.yml -i tests/inventory | tee -a ${idempotence}
- >
tail ${idempotence} | grep -q 'changed=0.*failed=0'
&& (echo 'idempotent' && exit 0)
|| (echo 'not idempotent' && exit 1)
# upgrade docker
- ansible-playbook tests/docker_20.10.3.yml -i tests/inventory
# check docker downgrade
- docker --version
- >
docker --version | grep 20.10.3
&& (echo 'docker upgraded' && exit 0)
|| (echo 'docker not upgraded' && exit 1)
# downgrade docker
- ansible-playbook tests/docker_20.10.1.yml -i tests/inventory
# check docker downgrade
- docker --version
- >
docker --version | grep 20.10.1
&& (echo 'docker downgraded' && exit 0)
|| (echo 'docker not downgraded' && exit 1)
notifications:
webhooks:
urls:
- https://galaxy.ansible.com/api/v1/notifications/
on_cancel: never
on_failure: never
on_error: never