variablescommand-linecommand-line-argumentsansible

How can I pass variable to ansible playbook in the command line?


How can one pass variable to ansible playbook in the command line?
The following command 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.


Solution

  • Reading the docs I find the section Passing Variables On The Command Line, that gives this example:

    ansible-playbook release.yml --extra-vars "version=1.23.45 other_variable=foo"
    

    Others examples demonstrate how to load from JSON string (≥1.2) or file (≥1.3)