Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

role fails in check mode if not having been executed in normal mode before #51

Open
pcahyna opened this issue Sep 30, 2019 · 1 comment
Assignees

Comments

@pcahyna
Copy link
Member

pcahyna commented Sep 30, 2019

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:

- name: Ensure that the role runs with default parameters
  hosts: all
  roles:
    - name: timesync
      vars:
        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"]}

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

@pcahyna 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
@pcahyna
Copy link
Member Author

pcahyna commented 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.

@vcrhonek vcrhonek mentioned this issue Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants