For this guide we are going to setup the playbook to establish passwordless SSH logins with the remote hosts. Passwordless logins is a great convenience when connecting to multiple servers.
Ansible installed on your local machine. For installation instructions, follow the official Ansible installation documentation. Familiarity with Ansible playbooks. For review, check out Configuration Management 101: Writing Ansible Playbooks.
Clone the repository to your ansible-enabled host: https://github.com/henshitou/ansible-ssh.git
Check below command are available to the PATH of the user you will be running the playbook as.
ssh-keygen ssh-copy-id sshpass
Edit the hosts file and define your environment's information
the filename of the new SSH key to be generated and stored under your .ssh folder of your localhost.
the username of the remote machines. If you are applying the procedure to multiple hosts.
the password of the "remote_machine_username" remote machines.
fill in the list of hosts that you want to establish the passwordless login with.
Execution command :
ansible-playbook -i hosts ansible_ssh.yml