forked from willshersystems/ansible-users
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
34 lines (28 loc) · 1.32 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
---
language: c
before_install:
- sudo add-apt-repository -y ppa:ansible/ansible
- sudo apt-get update -qq
- sudo apt-get -qq install ansible
install:
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
script:
# Check the roles syntax
- "ansible-playbook -i tests/inventory tests/test.yml --syntax-check"
# Run the role
- "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Tests user is correct
- id testuser1 | grep 'uid=1010(testuser1) gid=1010(testuser1) groups=1010(testuser1),27(sudo),998(testgroup1),1011(testgroup2)'
- id testuser2 | grep 'uid=999(testuser2) gid=998(testgroup1) groups=998(testgroup1)'
# Test for home directories
- test -d /home/testuser1
- test ! -d /home/testuser2
# Check ssh key
- sudo grep 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDPP/lgoFiuniGtCgmEXuwxmpeimWKoyAGgrHOaTfhnSBiIiDmh2pA3eNlm+iMk9tg103RDKMk4iWmsxlllormmdvAIy7P9L7oobuxtPAOQHqXr1zHwH3sbi2u3RQKmoxs= testkey' /home/testuser1/.ssh/authorized_keys