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
The task bellow is failing when running on check mode:
Task:
- name: Assert postfix check is successful, if not, show friendly message
assert:
msg: "`postfix check` failed. postfix has not been reloaded but some configurations might have been read by postfix. Run `postfix check`, find out error, fix it and deploy again"
that:
- register_postfix_check.rc == 0
Error:
TASK [external/postfix : Assert postfix check is successful, if not, show friendly message] ***********************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'register_postfix_check.rc == 0' failed. The error was: error while evaluating conditional (register_postfix_check.rc == 0): 'dict object' has no attribute 'rc'"}
This is happening because assert tries to evaluate a variable that wasn't created on the previous task (Validate all configurations) because command module doesn't run in check mode in some circunstances:
"Check mode is supported when passing creates or removes. If running in check mode and either of these are specified, the module will check for the existence of the file and report the correct changed status. If these are not supplied, the task will be skipped."
Adding a when: not ansible_check_mode (available since Ansible 2.1) should fix it.
I can open a PR with this simple patch if you need it.
Thank you!
The text was updated successfully, but these errors were encountered:
Hello guys,
The task bellow is failing when running on check mode:
Task:
Error:
This is happening because assert tries to evaluate a variable that wasn't created on the previous task (Validate all configurations) because
command
module doesn't run in check mode in some circunstances:"Check mode is supported when passing creates or removes. If running in check mode and either of these are specified, the module will check for the existence of the file and report the correct changed status. If these are not supplied, the task will be skipped."
Adding a
when: not ansible_check_mode
(available since Ansible 2.1) should fix it.I can open a PR with this simple patch if you need it.
Thank you!
The text was updated successfully, but these errors were encountered: