mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
Init repo
This commit is contained in:
6
tests/debian-jessie.Dockerfile
Normal file
6
tests/debian-jessie.Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM williamyeh/ansible:debian8-onbuild
|
||||
|
||||
RUN apt-get update
|
||||
CMD ["sh", "tests/test.sh"]
|
||||
|
||||
EXPOSE 6379
|
||||
6
tests/debian-wheezy.Dockerfile
Normal file
6
tests/debian-wheezy.Dockerfile
Normal 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
1
tests/inventory
Normal file
@@ -0,0 +1 @@
|
||||
localhost
|
||||
21
tests/test.sh
Normal file
21
tests/test.sh
Normal 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
5
tests/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
- ../../
|
||||
Reference in New Issue
Block a user