I'm new to ansible and wonder how to do so as the following didn't work
ansible-playbook -i '10.0.0.1,' yada-yada.yml --tags 'loaddata' django_fixtures="tile_colors"
Where django_fixtures
is my variable.
I'm new to ansible and wonder how to do so as the following didn't work
ansible-playbook -i '10.0.0.1,' yada-yada.yml --tags 'loaddata' django_fixtures="tile_colors"
Where django_fixtures
is my variable.
Other answers state how to pass in the command line variables but not how to access them, so if you do:
In your yml file you assign these to scoped ansible variables by doing something like:
An alternative to using command line args is to utilise environmental variables that are already defined within your session, you can reference these within your ansible yml files like this:
In the yml file you can use them like this
Also,
--extra-vars
and-e
are the same, you can use one of them.You can use the
--extra-vars
option. See the docsReading the docs I find the section Passing Variables On The Command Line, that give this sample:
Others examples demonstrate how to load from JSON string (≥
1.2
) or file (≥1.3
)For some reason none of the above Answers worked for me. As I need to pass several extra vars to my playbook in Ansbile 2.2.0, this is how I got it working (note the -e option before each var):