forked from singleplatform-eng/ansible-users
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
47 lines (40 loc) · 2.35 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
---
sudo: required
language: python
python: "2.7"
install:
- pip install ansible
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
script:
# Syntax Check
- ansible-playbook -i localhost, tests/test.yml --syntax-check
# Run test.yml
- ansible-playbook -i localhost, --connection=local -b tests/test.yml
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i localhost, --connection=local -b tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Lets check on the state of the users. I would invoke severspec myself however
# its a big thing to bring in on a small pull.
- id ansibletestuser | grep --silent "uid=2222(ansibletestuser) gid=2222(ansibletestuser) groups=2222(ansibletestuser),2(bin),100(users)"
- id ansibletestuser2 | grep --silent "uid=2223(ansibletestuser2) gid=2223(ansibletestuser2) groups=2223(ansibletestuser2),2(bin),100(users)"
- id ansibletestuser3 | grep --silent "uid=2224(ansibletestuser3) gid=4001(ansibletestgroup1) groups=4001(ansibletestgroup1),2(bin),100(users)"
- id ansibletestuser4 | grep --silent "uid=2225(ansibletestuser4) gid=100(users) groups=100(users),2(bin)"
- id ansibletestuser5 | grep --silent "uid=2226(ansibletestuser5) gid=4000(ansibletestgroup) groups=4000(ansibletestgroup),2(bin),100(users)"
- grep --silent "^ansibletestgroup:" /etc/group
- grep --silent "^ansibletestgroup1:" /etc/group
- ls -lgd /home/ansibletestuser | awk '{exit $3!="ansibletestuser"}'
- ls -lgd /home/otherdirectory | awk '{exit $3!="ansibletestuser2"}'
- ls -lgd /home/ansibletestuser3 | awk '{exit $3!="ansibletestgroup1"}'
- ls -lgd /home/otherdirectory1 | awk '{exit $3!="users"}'
- ls -lgd /home/ansibletestuser5 | awk '{exit $3!="ansibletestgroup"}'
- ls -lg /home/ansibletestuser/.profile | awk '{exit $3!="ansibletestuser"}'
- ls -lg /home/otherdirectory/.profile | awk '{exit $3!="ansibletestuser2"}'
- ls -lg /home/ansibletestuser3/.profile | awk '{exit $3!="ansibletestgroup1"}'
- ls -lg /home/otherdirectory1/.profile | awk '{exit $3!="users"}'
- ls -lgd /home/ansibletestuser5/.profile | awk '{exit $3!="ansibletestgroup"}'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/