So, this DOES work:
- name: Set date for demo 1
replace: dest={{ workdirectory2 }}/junk.java regexp='2016' replace="{{
hostvars['localhost']['year'] }}"
when: (is_demo and '{{ hostvars['localhost']['soft'] }}' == 'newapp')
Simply removing the double quotes around the 2nd part of the conditional
makes it work. So the new question is: Is that a bug?
J
On Tuesday, March 15, 2016 at 2:59:07 PM UTC-5, Slim Slam wrote:
>
> Do conditionals work with the replace module?
>
> I have something like this:
>
> - name: Set date for demo 1
> replace: dest={{ workdirectory2 }}/junk.java regexp='2016' replace="{{
> hostvars['localhost']['year'] }}"
> when: (is_demo and "'{{ hostvars['localhost']['soft'] }}' == 'newapp'")
>
> And it appears to ignore the "when" conditional entirely and always
> executes the replace.
>
> J
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/8b7f29fc-6311-40f0-b0e2-35f89a65dc76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.