FreeKB - Ansible --ask-pass (SSH) command line flag
Ansible - --ask-pass (SSH) command line flag

The --ask-pass flag can be used to prompt Ansible for your SSH password when making a connection to a host, like this.

ansible all -m ping --ask-pass

 

Which should produce a prompt asking for your SSH password.

SSH password:

 

If the SSH connection and ping are successful, the following should be displayed.

server1.example.com | SUCCESS => {	
    "changed": false,
    "ping": "pong" 
}

 

The --ask-become-pass flag can be used to prompt Ansible for your SSH password when making a connection to a host that requires elevated privileges, such as sudo.

Or, you could configure the /etc/ansible/hosts file with your SSH username and password.

Better yet, you can configure passwordless SSH authentication between the control node (that's your Ansible server) and managed nodes (e.g. target systems). If the control node is a Linux distribution, and the managed nodes are also a Linux distribution, and OpenSSH is being used on each managed node, refer to this article to configure passwordless SSH authentication between the servers.

Public key authentication with OpenSSH on Linux



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter b9cd1 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |