On 2/11/20 11:44 AM, Jesse Lyon wrote:
So,

I'm having fits with when conditionals matching strings
No matter what I do, it applies each conditional, the combination of the variables doesn't seem to count for ... anything.

what the heck am I doing wrong? additionally, is there a better way to do this?


Are you actually comparing the strings "yes" and "no" to the variables? If they're actual booleans, you will be better off by doing:

when: share_fim_managed and not share_azure_managed

when: not share_fim_managed and share_azure_managed

when: share_fim_managed and share_azure_managed


All nonempty strings are true, even if they contain the strings "false" or "true", you should be careful when comparing truth values. See here:


---
- hosts: localhost
  vars:
    truestringvar: "true"
    falsestringvar: "false"
    trueboolvar: true
    falseboolvar: false

  tasks:
    - debug:
        msg: Since booleans matter, this message is not shown.
      when: trueboolvar == 'true'
    - debug:
        msg: boolean values DO matter (this string is shown)
      when: trueboolvar
    - debug:
        msg: The string that says false is not false, this message will not be shown
      when: not falsestringvar





--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0ebabe47-8b80-60e3-3eb3-87d301627c0b%40redhat.com.

Reply via email to