diff --git a/common-tasks/test-force-package-cache-update.yml b/common-tasks/test-force-package-cache-update.yml index e9bf9473..4b16b4e4 100644 --- a/common-tasks/test-force-package-cache-update.yml +++ b/common-tasks/test-force-package-cache-update.yml @@ -20,5 +20,6 @@ retries: 5 delay: 2 until: _update | succeeded + changed_when: false when: - ansible_pkg_mgr == 'apt' diff --git a/common-tasks/test-set-nodepool-vars.yml b/common-tasks/test-set-nodepool-vars.yml index 2068d96e..266aced7 100644 --- a/common-tasks/test-set-nodepool-vars.yml +++ b/common-tasks/test-set-nodepool-vars.yml @@ -27,6 +27,7 @@ executable: /bin/bash register: lxc_reverse_proxy delegate_to: localhost + changed_when: false when: - nodepool.stat.exists | bool tags: @@ -46,6 +47,7 @@ executable: /bin/bash register: uca_repo_url delegate_to: localhost + changed_when: false when: - ansible_pkg_mgr == 'apt' - nodepool.stat.exists | bool @@ -67,6 +69,7 @@ executable: /bin/bash register: centos_mirror_url delegate_to: localhost + changed_when: false when: - ansible_pkg_mgr in ['yum', 'dnf'] - nodepool.stat.exists | bool @@ -89,6 +92,7 @@ executable: /bin/bash register: _opensuse_mirror delegate_to: localhost + changed_when: false when: - ansible_pkg_mgr == 'zypper' - nodepool.stat.exists | bool @@ -126,6 +130,7 @@ executable: /bin/bash register: _pypi_wheel_mirror delegate_to: localhost + changed_when: false when: - nodepool.stat.exists | bool diff --git a/test-ansible-functional.sh b/test-ansible-functional.sh index 74103764..f12c37c6 100755 --- a/test-ansible-functional.sh +++ b/test-ansible-functional.sh @@ -135,12 +135,13 @@ if [ "${TEST_IDEMPOTENCE}" == "true" ]; then # Execute the test playbook execute_ansible_playbook - # Check the output log for changed/failed tasks - if grep -q "changed=0.*failed=0" ${ANSIBLE_LOG_PATH}; then - echo "Idempotence test: pass" - else + # Exit with a failure if we find "changed" or "failed" followed by anything + # other than a zero. + if grep -qP '(changed|failed)=(?!0)' ${ANSIBLE_LOG_PATH}; then echo "Idempotence test: fail" exit 1 + else + echo "Idempotence test: pass" fi fi