forked from tschifftner/ansible-role-php5-fpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
executable file
·79 lines (63 loc) · 2.13 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
---
sudo: required
dist: trusty
language: python
python: "2.7"
env:
- SITE=test.yml ANSIBLE_VERSION=latest
- SITE=test.yml ANSIBLE_VERSION=2.1.0.0
branches:
only:
- master
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y curl
install:
# Install Ansible.
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install --no-binary ansible ansible; else pip install --no-binary ansible ansible==$ANSIBLE_VERSION; fi
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
# Install ansible-lint
- pip install ansible-lint
script:
# Check the role/playbook's syntax.
- ansible-playbook -i tests/inventory tests/$SITE --syntax-check
# Run the role/playbook with ansible-playbook.
- ansible-playbook -i tests/inventory tests/$SITE --connection=local --become
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/$SITE --connection=local --become
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# ansible-lint checks for best practice
- ansible-lint tests/$SITE
# Check if php is installed
- >
sudo php -v
&& (echo 'PHP installed' && exit 0)
|| (echo 'PHP is not installed' && exit 1)
# Check if socket exists
- >
test -e /run/travis.socket
&& (echo 'PHP socket exists' && exit 0)
|| (echo 'PHP socket does not exist' && exit 1)
- >
sudo php -v | grep ionCube
&& (echo 'ionCube installed' && exit 0)
|| (echo 'ionCube is not installed' && exit 1)
after_failure:
# run playbook again to see idempotence failures
- ansible-playbook -i tests/inventory tests/$SITE --connection=local --become -vvv
- service php5-fpm status
- sudo php -v
- 'ls -l /etc/php5/fpm/pool.d/'
- 'ls -l /run/'
- sudo tail -n150 /var/log/syslog
- ansible --version
- ansible-lint --version
- sudo ls -l /usr/lib/php5/ioncube/
- php /var/www/html/index.php
notifications:
slack: ambimax:2MlPTX9bY9aPxCPhJGxHKIT6
webhooks: https://galaxy.ansible.com/api/v1/notifications/