Don't need inventory file for localhost
parent
74732767a5
commit
4721f8a4ec
|
@ -1 +0,0 @@
|
||||||
localhost
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue