# Conditional broken with Ansible 2.2.1.0-1 running on Rhel6/CentOS6

**URL:** <https://forum.ansible.com/t/conditional-broken-with-ansible-2-2-1-0-1-running-on-rhel6-centos6/23489>\
**Category:** Ansible Project\
**Created:** [January 18, 2017, 12:36pm UTC](https://forum.ansible.com/t/conditional-broken-with-ansible-2-2-1-0-1-running-on-rhel6-centos6/23489 "2017-01-18T12:36:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhilEv](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@PhilEv](https://forum.ansible.com/u/PhilEv)\
**Post date:** [January 18, 2017, 12:36pm UTC](https://forum.ansible.com/t/conditional-broken-with-ansible-2-2-1-0-1-running-on-rhel6-centos6/23489/1 "2017-01-18T12:36:57Z")

</div>

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
