You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We fixed failures in check mode some time ago and now the role does not fail if executed in check mode after having been executed in normal mode. There is still a problem though when the role is executed in check mode on a fresh system (without having been applied in normal mode before), because it assumes that some packages are installed, and in check mode they do not get installed. This is the case described in ansible/molecule#128 (comment) (note that the current Molecule setup does not test for it, as explained in that link).
The change submitted by @hhaniel in #27 (comment) should fix this case as well.
Test playbook:
- name: Ensure that the role runs with default parametershosts: allroles:
- name: timesyncvars:
timesync_ntp_provider: ntp
error:
TASK [timesync : Get ntp version] **********************************************
fatal: [/home/pcahyna/linux-system-roles-testing/local/CentOS-7-x86_64-GenericCloud-1702.qcow2c]: FAILED! => {"changed": false, "cmd": ["rpm", "-q", "--qf", "%{version}", "ntp"], "delta": "0:00:00.033978", "end": "2019-09-30 14:53:22.430978", "msg": "non-zero return code", "rc": 1, "start": "2019-09-30 14:53:22.397000", "stderr": "", "stderr_lines": [], "stdout": "package ntp is not installed", "stdout_lines": ["package ntp is not installed"]}
pcahyna
changed the title
role fails when executed in check mode if not having been executed in normal mode before
role fails in check mode if not having been executed in normal mode before
Sep 30, 2019
Note that the test uses the ntp provider, because chrony is installed in that image, therefore the problem does not show up with the default provider, at least not with the CentOS image I used.
Followup to #27 .
We fixed failures in check mode some time ago and now the role does not fail if executed in check mode after having been executed in normal mode. There is still a problem though when the role is executed in check mode on a fresh system (without having been applied in normal mode before), because it assumes that some packages are installed, and in check mode they do not get installed. This is the case described in ansible/molecule#128 (comment) (note that the current Molecule setup does not test for it, as explained in that link).
The change submitted by @hhaniel in #27 (comment) should fix this case as well.
Test playbook:
error:
TASK [timesync : Get ntp version] **********************************************
fatal: [/home/pcahyna/linux-system-roles-testing/local/CentOS-7-x86_64-GenericCloud-1702.qcow2c]: FAILED! => {"changed": false, "cmd": ["rpm", "-q", "--qf", "%{version}", "ntp"], "delta": "0:00:00.033978", "end": "2019-09-30 14:53:22.430978", "msg": "non-zero return code", "rc": 1, "start": "2019-09-30 14:53:22.397000", "stderr": "", "stderr_lines": [], "stdout": "package ntp is not installed", "stdout_lines": ["package ntp is not installed"]}
PLAY RECAP *********************************************************************
/home/pcahyna/linux-system-roles-testing/local/CentOS-7-x86_64-GenericCloud-1702.qcow2c : ok=3 changed=1 unreachable=0 failed=1 skipped=9 rescued=0 ignored=0
The text was updated successfully, but these errors were encountered: