Hello
The ansible 2.2.1.0-1 running on Rhel6/CentOS6 leads to error for existing playbooks with roles applied conditionally.
The fix is available in the stable-2.2 branch (and others)
We have numerous playbooks based on the conditional role execution
When can we expect a 2.2.1.0-2 version - or any ansible 2.2.1.next ?
How to reproduce:
RHEL6/CentOS6 as Ansible control node.
In the playbook apply/Call a role conditionally as below :
- role: ntpd_slewing_mode
tags: [“ntp_options”]
when: ansible_distribution_major_version == “6”
It leads to the following error:
TASK [ntpd_slewing_mode : Add the -x as OPTIONs if not in /etc/sysconfig/ntpd] *
fatal: [127.0.0.1]: FAILED! => {“failed”: true, “msg”: “The conditional check ‘ansible_distribution_major_version == "6"’ failed. The error was: ’
AnsibleEnvironment’ object has no attribute ‘_generate’\n\nThe error appears to have been in ‘/usr/share/oetune/playbooks/roles/ntpd_slewing_mode/tasks/main.yml’: line 26, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Add
the -x as OPTIONs if not in /etc/sysconfig/ntpd\n ^ here\n”}
Applying the Fix for
‘bug in Conditional for older jinja2 versions’
aka commit: 2f0dba4f36238f0f740467161ae00f22041cd423 (on branch stable-2.2)
or building from source using branch stable2.2
Solved the issue.
Thanks
Phil