Ansible looks in the files directory of the role first by design, yes.



On Tue, Nov 19, 2013 at 12:54 PM, Mayeu <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Thank you for your response.
>
> On Mon, 18 Nov 2013 14:23:51 -0500
> Michael DeHaan <[email protected]> wrote:
> >
> > src=../../{{ inventory_hostname }}/file.txt ?
> >
> > Consider looking into "with_first_found" if you want to look into
> > multiple locations and have a default.
>
> Both those solutions assumes that I know what is the path to the file,
> wich may not be true. If the playbook may be a role of one playbook, or
> a role of a role, wich then make it not always possible to know the
> inclusion level.
>
> By accident I discover something that allow me to do file precedence.
> Basically, instead of putting src=<file_name> I used
> src=files/<file_name>. By default Ansible use only `./files/<file_name>`
> of the playbook, by adding `files/`, Ansible get the first <file_name>
> found in a `files` folder, thus using precedence.
>
> I made a little repository to illustrate this:
> https://github.com/Mayeu/ansible-playbook-file_precedence_test
>
> So, is it a bug, or a feature? If it is a bug, it should be promoted to
> a feature, it is really handy to have file precedence when you try to
> have generic playbook. If it is already a feature, I missed the part in
> the doc specifying that :)
>
> - --
> Mayeu
> http://6x9.fr
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (GNU/Linux)
>
> iQIcBAEBCgAGBQJSi6XtAAoJEBvq3fb6KsuhzSgP/jMytqrWz3wDpXlPf8uM/pRd
> 6qnA2p7ekim75ksrtcX+04LmTFhEzjKcbnjVo8e0QvldQbGLLYygpT91vbRONDeh
> gDFFxZ8l2FaM7MCMcYypX9xaU03he+fa6xXLeuQvFcyYOPcFxvpVbodWC8dMhyEU
> aRnQ4lJLBe7sHKdvDB7vvEeWTyJjOlJjZVF5SsqPEgEY8yIvT9irAc517ua3e0if
> tYMbWfH6y8ZQHHBJyxUOlMDrAFB7/FOwxOfu+3fqrQsUjbaZ0CBhiW+EdfAGdjw5
> P3niH4UX/MiMywsfIgq4nuqv7Gf6TeRvOm2l8PG6nsnjB4JRQGH3AkfLef1EXLOQ
> U85Bi8ZeS8eP/ha/l9OOr9OR95x/mXYCHhIKQkrVI9fnj2EBAtNl1AvPh5OZRFTF
> ExhXVRtkaoWbPv905qwhzGC2TgcoOqLXPyeI5IbQbu3/FlSDJHZ97vw/+NLsGVou
> qjD0gLZfqrvNVGfT7nlLnnav/IhrIIxfKs3rQd6buojdtSl+cn3uL52LtN62M5PQ
> UzXsvEULe508UhMDX0to9o0+GPQrN39i7YABJHJv2rVnfMLWLHYjnTjpP7X0kpul
> f4HprbUvaiCBIqJ50vNnRoneqjoM2xBEVrGkDIEpS7aAAEm346iFXvcSyC8uhS42
> RWCQzHK1pEa4e2hx113j
> =NwYH
> -----END PGP SIGNATURE-----
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Michael DeHaan <[email protected]>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to