Don't need any inventory file for tests
parent
1204dbacd1
commit
4dcb5f44c6
|
@ -1 +0,0 @@
|
|||
localhost
|
|
@ -3,19 +3,18 @@
|
|||
# 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
|
||||
ansible-playbook -i localhost, -c local --syntax-check -vv $PLAYBOOK
|
||||
|
||||
# Check role
|
||||
ansible-playbook -i $INVENTORY_FILE -c local --sudo -vv $PLAYBOOK
|
||||
ansible-playbook -i localhost, -c local --sudo -vv $PLAYBOOK
|
||||
|
||||
# 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' \
|
||||
&& (echo 'Idempotence test: pass' && exit 0) \
|
||||
|| (echo 'Idempotence test: fail' && exit 1)
|
||||
|
|
Loading…
Reference in New Issue