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

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

     s3_sync:
          bucket: ansible-harshika
          file_root: "{{ pathoftsfiles  }}"
          validate_certs: false 
          mode: push
          key_prefix: "{{ folder }}"
    

    here the variables are being used named as 'pathoftsfiles' and 'folder'. Now the value to this variable can be given by the below command

    sudo ansible-playbook multiadd.yml --extra-vars "pathoftsfiles=/opt/lampp/htdocs/video/uploads/tsfiles/$2 folder=nitesh"
    

    Note: Don't use the inverted commas while passing the values to the variable in the shell command

提交回复
热议问题