Don't need any inventory file for tests

pull/22/head
Emilien Mantel 2016-03-23 17:27:59 +01:00
parent 1204dbacd1
commit 4dcb5f44c6
2 changed files with 3 additions and 5 deletions

View File

@ -1 +0,0 @@
localhost

View File

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