Assign to a variable a string with the same name as the variable name does not work (i.e: var1="var1" does not work)

3 views
Skip to first unread message

Moshe Suberri

unread,
Apr 21, 2016, 5:32:59 PM4/21/16
to Ansible Project


playbook file
:
#var-test.yml
---

- name: Testing
  hosts: localhost
  gather_facts: no   
  tasks:
    - set_fact:
         var1="var1"
         var2="not var2 name"
       
    - debug: var=var1
    - debug: var=var2


-------------------------------------------------
the run output:

PLAY [Testing] *****************************************************************

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

TASK [debug] *******************************************************************
ok: [localhost] => {
    "var1": "VARIABLE IS NOT DEFINED!"
}

TASK [debug] *******************************************************************
ok: [localhost] => {
    "var2": "not var2 name"
}

Reply all
Reply to author
Forward
0 new messages