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

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200502193803.GB3973%40torres.zugschlus.de.

Reply via email to