-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
59 lines (46 loc) · 1.62 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
---
language: python
python: "2.7"
before_install:
# Remove MySQL.
- sudo apt-get -y purge 'mysql*'
- sudo apt-get -y autoremove
- sudo apt-get -y autoclean
- sudo rm -rf /var/lib/mysql
- sudo truncate -s 0 /var/log/mysql/error.log
- sudo apt-get update
install:
# Install Ansible.
#- sudo apt-get -y install python-software-properties
#- sudo apt-add-repository -y ppa:ansible/ansible
#- sudo apt-get -y install ansible
#- ansible-playbook --version
- pip install ansible
script:
# Check the role/playbook's syntax.
- ansible-playbook -i inventories/local.ini deploy.yml --syntax-check
# Run the role/playbook with ansible-playbook.
- ansible-playbook -i inventories/local.ini deploy.yml
# Idempotence Test
- >
ansible-playbook -i inventories/local.ini deploy.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Some MySQL debugging (show all the logs).
- "sudo ls -lah /var/log"
- "sudo cat /var/log/mysql/error.log"
# Check to make sure we can connect to MySQL.
- >
sudo -i mysql -u root -e 'show databases;'
| grep -q 'performance_schema'
&& (echo 'MariaDB running normally' && exit 0)
|| (echo 'MariaDB not running' && exit 1)
# Run test
- ansible-playbook -i inventories/local.ini test.yml
# Verify test
- >
ansible-playbook -i inventories/local.ini test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)