Hi List,
I've always been following along with the examples here:
for instance:
```
- name: Disable requiretty
lineinfile:
dest: /etc/sudoers
regexp: "Defaults requiretty"
line: "# Defaults requiretty"
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"
```
But when I run that with Ansible > 2.0 it gives me a deprecation message:
```
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{ansible_os_family}}').
This feature will be removed in a future release.
```
When I change the code to this:
```
- name: Disable requiretty
lineinfile:
dest: /etc/sudoers
regexp: "Defaults requiretty"
line: "# Defaults requiretty"
when: "{{ ansible_os_family }} == 'RedHat' and {{ ansible_distribution_major_version }} == '7'"
```
I get the error:
```
fatal: [10.20.113.218]: FAILED! => {"failed": true, "msg": "The conditional check '{{ ansible_os_family }} == 'RedHat' and {{ ansible_distribution_major_version }} == '7'' failed. The error was: error while evaluating conditional ({{ ansible_os_family }} == 'RedHat' and {{ ansible_distribution_major_version }} == '7'): 'Debian' is undefined\n\nThe error appears to have been in '/home/mark/Documents/persgroep-aws/roles/vnucommon/tasks/main.yml': line 8, 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: Disable requiretty\n ^ here\n"}
```
Am I missing something here?
Thanks,
Mark Maas