How to pass a user / password in ansible command

Question:

I want to use Ansible as part of another Python software. in that software I have a hosts list with their user / password.

Is there a way to pass the user / pass of the SSH connection to the Ansible ad-hoc command or write it in any file in encrypted way?

Or do i understand it all wrong, and the only way to do it is with SSH certification?

Answer:

The docs say you can specify the password via the command line:

-k, --ask-pass.
ask for connection password

Ansible can also store the password in the ansible_password variable on a per-host basis.

Leave a Reply