On Thu, 7 May 2020 02:25:16 -0700 (PDT)
דודו דודו <dudu.conf...@gmail.com> wrote:

> Using domain_name | default("") == ""  skip the task no matter if i have 
> value or not 

This is not what I see. Both the comparison to an empty string and testing
the length should work. For example

 hosts: localhost
  tasks:
    - debug:
        msg: Non-existent or empty
      when: domain_name|default("") == ""
    - debug:
        msg: Non-existent or empty
      when: domain_name|default("")|length == 0
    - set_fact:
        domain_name: example.com
    - debug:
        msg: Non-existent or empty
      when: domain_name|default("") == ""
    - debug:
        msg: Non-existent or empty
      when: domain_name|default("")|length == 0

gives

  TASK [debug] ************
  ok: [localhost] => {
      "msg": "Non-existent or empty"
  }

  TASK [debug] ************
  ok: [localhost] => {
      "msg": "Non-existent or empty"
  }

  TASK [set_fact] ***************
  ok: [localhost]

  TASK [debug] ************
  skipping: [localhost]

  TASK [debug] ************
  skipping: [localhost]


The comparison to an empty string is deprecated.

HTH,

        -vlado

-- 
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/20200507115758.460259d8%40gmail.com.

Attachment: pgp0r6ysRCHD3.pgp
Description: OpenPGP digital signature

Reply via email to