$ cat inv 
local ansible_connection=local
$ cat playbook.yml 
---
- hosts: local
  tasks:
  - debug: msg="foo"
    when: bar is not defined
  - set_fact: bar=hello
  - debug: msg="baz {{ bar }}"
    when: bar is not defined
$ ansible-playbook -i inv playbook.yml 

PLAY [local] 
****************************************************************** 

GATHERING FACTS 
*************************************************************** 
ok: [local]

TASK: [debug msg="foo"] 
******************************************************* 
ok: [local] => {
    "msg": "foo"
}

TASK: [set_fact bar=hello] 
**************************************************** 
ok: [local]

TASK: [debug msg="baz {{ bar }}"] 
********************************************* 
skipping: [local]

PLAY RECAP 
******************************************************************** 
local                      : ok=3    changed=0    unreachable=0    failed=0 
  

$

Why second debug task is skipped?

-- 
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/431fd555-27cc-483d-ac65-5f5016df6c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to