pass variable filename as command line argument

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

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.

Hi,

That’s exactly what I have been looking for.

Thanks,