I've been playing around with paramaterized playbook includes, and I think 
I have discovered a bug, but perhaps it is expected behavior, so I thought 
I would ask.

The short version is that parameters do not override data from vars_files. 
 I presume this is not the expected behavior?  I didn't have any luck 
finding documentation that would tell me for sure either way.

I've only tested on 1.9.0.1, so it is possible that it is fixed in dev, but 
I've not had a change to test that.  

Now with much more detail...

Let's say you have play.yml with the following:

- hosts: all
  include: include.yml parameter=passed

And then you have include.yml:

- hosts: all
  vars:
    parameter: vars
  tasks:
    - debug:
        msg: parameter={{ parameter }}

This results in what to me is the expected result (the parameter overrides 
the value from 'vars':

ok: [sun.apomorph.com] => {

    "msg": "parameter=passed"

}


However, if you create vars.yml with the following:


parameter: file


And then change include.yml to contain the following:


- hosts: all

  vars:

    parameter: vars

  vars_files:

    - vars.yml

  tasks:

    - debug:

        msg: parameter={{ parameter }}


The result is not what I would expect (the value from vars_file is utilized:

TASK: [debug ] 
**************************************************************** 

ok: [sun.apomorph.com] => {

    "msg": "parameter=file"

}



-- 
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/6d5f8e5e-9c84-4b5f-8f34-e22f48492993%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to