Hi,
I like constructs like the following:
- name: MPM prefork
file:
src: "../../apache2/mods-available/{{ configfile }}"
dest: "/etc/apache2{{ instance_dashsuffix }}/mods-enabled/{{ configfile }}"
state: "{{ (instance.instance_data.mpm=='prefork') | ternary('link','absent') }}"
loop_control:
loop_var: "configfile"
loop:
- "mpm_prefork.load"
- "mpm_prefork.conf"
A warning tells me that having state=absent and a source at the same time will
be an error in ansible 2.10
How would I write this in the future?
I do sincerely hope that I wouldn't be forced to write two tasks like:
- name: MPM prefork on
file:
src: "../../apache2/mods-available/{{ configfile }}"
dest: "/etc/apache2{{ instance_dashsuffix }}/mods-enabled/{{ configfile }}"
state: "link"
when: "{{ (instance.instance_data.mpm=='prefork') }}"
loop_control:
loop_var: "configfile"
loop:
- "mpm_prefork.load"
- "mpm_prefork.conf"
- name: MPM prefork on
file:
dest: "/etc/apache2{{ instance_dashsuffix }}/mods-enabled/{{ configfile }}"
state: "absent"
when: "{{ (instance.instance_data.mpm!='prefork') }}"
loop_control:
loop_var: "configfile"
loop:
- "mpm_prefork.load"
- "mpm_prefork.conf"
causing a lot of duplication.
Greetings
Marc