forked from DavidWittman/ansible-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
47 lines (43 loc) · 1.7 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
---
language: python
python: "2.7"
env:
- ANSIBLE_VERSION=1.9.4
- ANSIBLE_VERSION=latest
before_install:
- sudo apt-get update -qq
install:
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
script:
# Syntax check
- "ansible-playbook -i localhost, test/test_server.yml --syntax-check"
- "ansible-playbook -i localhost, test/test_sentinel.yml --syntax-check"
# Test Redis Server
- "ansible-playbook -i localhost, test/test_server.yml --connection=local --sudo"
# Idempotency check
- >
ansible-playbook -i localhost, test/test_server.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotency: PASS' && exit 0)
|| (echo 'Idempotency: FAIL' && exit 1)
# Test Redis Sentinel
- "ansible-playbook -i localhost, test/test_sentinel.yml --connection=local --sudo"
- >
ansible-playbook -i localhost, test/test_sentinel.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotency: PASS' && exit 0)
|| (echo 'Idempotency: FAIL' && exit 1)
# Connection test
- "/opt/redis/bin/redis-cli PING"
- "/opt/redis/bin/redis-cli -p 26379 PING"
# Facts syntax check
- >
sudo cat /etc/ansible/facts.d/redis.fact
| python -m json.tool
&& (echo 'Facts syntax: PASS' && exit 0)
|| (echo 'Facts syntax: FAIL' && exit 1)
# Test all replication components (server, slave, sentinel)
# No idempotency check here (yet) because the sentinel config writes to itself
# after a config is discovered from the Redis server.
- ansible-playbook -i localhost, test/test_all.yml --connection=local --sudo