On Sat, May 02, 2020 at 09:38:03PM +0200, Marc Haber wrote:
> 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?
You need to add ternary on src also and use the variable omit when false.
https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#omitting-parameters
I must say, I don't understand why they are doing this change. It make us write
more code that IMHO makes the code more difficult to read.
--
Kai Stian Olstad
--
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/20200502210058.fsix6mq4pox5lqch%40olstad.com.