Hi,
to avoid copying many tasks I was trying to use the ternary() filter as
seen in
https://groups.google.com/forum/#!msg/ansible-project/4bhkNQvrbhc/Vs3u8QQVCAAJ
goal:
If I'm on debian based systems I'd like the owner to be
_tor-{{ item[0] }}_{{ item.1.orport }}
on other systems it should just be
{{ tor_user }}
this is one example of a currently working tasks which I would like to
condense into one by using the ternary() filter:
- name: Ensure directory exists and is owned by tor_user
file: path={{ tor_DataDir }}/{{ item[0] }}_{{ item.1.orport }}
state=directory
owner={{ tor_user }}
with_nested:
- "{{ tor_ips }}"
- "{{ tor_ports }}"
when: ansible_pkg_mgr != 'apt'
- name: Ensure directory exists and is owned by tor_user
file: path={{ tor_DataDir }}/{{ item[0] }}_{{ item.1.orport }}
state=directory
owner=_tor-{{ item[0] }}_{{ item.1.orport }}
with_nested:
- "{{ tor_ips }}"
- "{{ tor_ports }}"
when: ansible_pkg_mgr == 'apt'