Simple task.
- name: Rotate log as this user and group (14.04 or newer)
lineinfile: >
dest=“/etc/logrotate.conf”
regexp=“^su root syslog”
insertbefore=“BOF”
line=“su root syslog\n”
state=“present”
when: “‘{{ ansible_distribution }}’ == ‘Ubuntu’ and ‘{{ ansible_lsb.release }}’|float >= 14.04”
tags: logrotate
Works great until I brought my OpenIndiana systems into Ansible.
I thought the “when:” would be short circuited and the ansible_lsb.release would never be looked at if the ansible_distribution failed.
On OpenIndiana I get:
TASK [logrotate : Rotate log as this user and group (14.04 or newer)] **********
fatal: [crashplan.int.linvill.com]: FAILED! => {“failed”: true, “msg”: “ERROR! The conditional check ‘’{{ ansible_distribution }}’ == ‘Ubuntu’ and ‘{{ ansible_lsb.release }}’|float >= 14.04’ failed. The error was: ERROR! ‘ansible_lsb’ is undefined”}
https://groups.google.com/forum/#!topic/ansible-project/MR0ZxncUCJA would make it seem like things should be short circuited ?