pass variable filename as command line argument

7,138 views
Skip to first unread message

cpat...@xervmon.com

unread,
Nov 18, 2013, 8:43:02 AM11/18/13
to ansible...@googlegroups.com
Hi, 

I have used var_files to include a variable file inside of a playbook.

But I would like to know whether it's possible to pass the file path as a part of the ansible-playbook command itself.

Thanks,
Chinmaya

Timothy Appnel

unread,
Nov 18, 2013, 4:56:25 PM11/18/13
to ansible...@googlegroups.com, ansible...@googlegroups.com

I've added a var_file from the command line using a variable inside of the extra-vars option on the command line. Something like...


    $ ansible-playbook all some_plabook.yml --extra-vars="myvarfile=/path/to/varfile"


Where some_plabook.yml has a:


    vars_files: {{ myvarfile }}


It's a bit verbose and ugly as opposed to having an explicit var-file option, but it works.

<tim/>

Sent from my iPhone

cpat...@xervmon.com

unread,
Nov 19, 2013, 2:11:28 AM11/19/13
to ansible...@googlegroups.com
Hi,

That's exactly what I have been looking for.

Thanks,
Reply all
Reply to author
Forward
0 new messages