Le 09/02/21 à 12:29, Vladimir Botka <
vbo...@gmail.com> a écrit :
Yes, but instead of my uniq task I need to write the same thing twice
- name: enable plugins for baremetal only
file:
state: link
path: "/etc/munin/plugins/{{ item }}"
src: "/usr/share/munin/plugins/{{ item }}"
loop:
- acpi
- cpu
when: is_baremetal|bool
- name: disable same plugins for others
file:
state: absent
path: "/etc/munin/plugins/{{ item }}"
loop:
- acpi
- cpu
when: not is_baremetal
And to avoid inconsistency between these two task, a var or set_fact task need to be added (to
guarantee the same list in both task).
Much more complicated than a ternary in state prop of a uniq task…
It's just a remark, why forbid such a way to switch state link|absent ?
--
Daniel
L'homme est imparfait, mais ce n'est pas étonnant si l'on songe à
l'époque où il fut créé.
Alphonse Allais