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

后端 未结 10 1928
不知归路
不知归路 2021-01-29 21:57

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=\"t         


        
10条回答
  •  失恋的感觉
    2021-01-29 22:22

    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):

    ansible-playbook site.yaml -i hostinv -e firstvar=false -e second_var=value2
    

提交回复
热议问题