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

后端 未结 10 1944
不知归路
不知归路 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:14

    ansible-playbook release.yml --extra-vars "username=hello password=bye"
    
    #you can now use the above command anywhere in the playbook as an example below:
    tasks:
    - name: Create a new user in Linux
    shell: useradd -m -p {{username}} {{password}}"
    

提交回复
热议问题