Init repo

This commit is contained in:
Emilien Mantel
2015-07-15 12:14:39 +02:00
parent a9bd03015f
commit 64cf8b53a4
13 changed files with 253 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
FROM williamyeh/ansible:debian8-onbuild
RUN apt-get update
CMD ["sh", "tests/test.sh"]
EXPOSE 6379

View File

@@ -0,0 +1,6 @@
FROM williamyeh/ansible:debian7-onbuild
RUN apt-get update
CMD ["sh", "tests/test.sh"]
EXPOSE 6379

1
tests/inventory Normal file
View File

@@ -0,0 +1 @@
localhost

21
tests/test.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
# Thanks to https://servercheck.in/blog/testing-ansible-roles-travis-ci-github
DIR=$( dirname $0 )
INVENTORY_FILE="$DIR/inventory"
PLAYBOOK="$DIR/test.yml"
set -ev
# Check syntax
ansible-playbook -i $INVENTORY_FILE -c local --syntax-check -vv $PLAYBOOK
# Check role
ansible-playbook -i $INVENTORY_FILE -c local --sudo -vv $PLAYBOOK
# Check indempotence
ansible-playbook -i $INVENTORY_FILE -c local --sudo -vv $PLAYBOOK \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) \
|| (echo 'Idempotence test: fail' && exit 1)

5
tests/test.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- hosts: all
roles:
- ../../