Enter code here...
When I pass a variable to include: statement, using value from extra vars, 
the value inside the included task file is still the value from host_vars, 
not extra vars (while extra vars are considered as highest precedence)

Here'e an example


- name: test extra var
  hosts: localhost
    connection: local
  gather_facts: no

    - include: task.yml internal_var={{my_var}}


- name: print internal_var

  debug: msg="hello, {{internal_var}}"


localhost ansible_connection=local

my_var: I am from host_vars

then test

LAZ-VN-L-M-1034:test user$ ansible-playbook -i inventory main.yml -e 

PLAY [pulling Avanan Registration Management UI from git remote repository] 

TASK: [print internal_var] 
ok: [localhost] => {
    "msg": "hello, I am from host_vars"

localhost                  : ok=1    changed=0    unreachable=0    failed=0 


It still takes value from host_vars/localhost even though extra var is 

Is it an error? Ansible version is  1.9.4

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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to