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

Issue with older versions of Jinja2 version 2.2 in Ubuntu12.04 image. #1

Closed
yabhinav opened this issue Feb 26, 2017 · 1 comment
Closed

Comments

@yabhinav
Copy link
Owner

This issue is similar to ansible/ansible#20309

- name: Restart NTP
  service: name={{ntp_service_name}} state=restarted enabled=yes
  become: True
  when: ntp_conf.changed or ntpd_conf.changed
TASK [role_under_test : Restart NTP] *******************************************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "The conditional check 'ntp_conf.changed or ntpd_conf.changed' failed. The error was: 'AnsibleEnvironment' object has no attribute '_generate'\n\nThe error appears to have been in '/etc/ansible/roles/role_under_test/tasks/main.yml': line 32, 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: Restart NTP\n  ^ here\n"}

Should be fixed with next release as the patch has been released. Or we can test different version of Jinja2 in the image

@yabhinav
Copy link
Owner Author

the issue is fixed by moving the above task to handlers

Also user quotes for older versions of Jinja2. Examples

when : "{{ firewall_service is defined }}"

when: "{{ ansible_os_family == 'Redhat' and ansible_selinux is defined and 'status' in ansible_selinux and ansible_selinux.status == 'enabled' }}"

when: "{{ ansible_os_family == 'Debian' }}"

Surrounding in quotes seem to have solved the problem, might be due to the older versions not supporting free forms like

when :  firewall_service is defined 

when: ansible_os_family == 'Redhat' and ansible_selinux is defined and 'status' in ansible_selinux and ansible_selinux.status == 'enabled' 

when:  ansible_os_family == 'Debian' 

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

1 participant