Ansible 2.1.2 playbook pass SSH password and sudo password as command line args

ansible

I've looked around but couldn't find a proper solution, I want to run playbook for multiple users on multiple hosts and my roles use the user specific info such as name, email, id … Now instead of running the playbook for each user I wrote a python script that invokes the ansible

ansible-playbook -i hosts --ask-become-pass --ask-pass ./playbooks/myplaybook.yml

But for the above command to work I want to pass SSH password and SUDO password as arguments to the command. I checked ansible-playbook documentation but was unable to find it. What would be the best way to achieve this?

Best Answer

You can specify the following parameters from the command line:

… -e "ansible_user=username ansible_ssh_pass=xxx ansible_sudo_pass=xxx" …
Related Topic