DEV Community

Abhishek Korde
Abhishek Korde

Posted on

1 1 1 1 1

How to configure passwordless authentication using Ansible

There are many method in ansible for configuring password-less Authentication like:

  1. copy public key to remote hosts
  2. Test SSH Access
  3. Configure Ansible Invertory
  4. Run Ansible ping Test
  5. Generate SSH Key Generally I prefers Generate SSH key because secure, efficient, and automated way to manage infrastructure. first thing is to install ansible in your system using below commands:

Image description

Image description
create I create two EC2 instances in AWS Servers.

Image description
main server we are using is Ansible_server and target_server is target_ubuntu
login in Ansible_server first and trying to talk to with target_server i.e target_ubuntu
for login Ansible_server, write following command:

Image description
This ssh-keygen will generate key for you like below it will ask for information
Image description
after that there is one directory is created and in that directory there is set of files.
these files stored in /home/ubuntu/.ssh/
id_rsa will store private key and id_rsa.pub will store public key
go to that directory where are key are stored.

Image description
this will print the public key, copy this public key and login in target_server and do same process.
Image description

Image description
This will create same set of files.then open the authorized_keys file and paste the copied the public ip address.
after completing this come back to main server i.e Ansible_servers and write below command:

Image description
command: ssh ip_address, this ip address is private ip address of terget server.
now see we are sucessfully login our targer_server without any password
Github:https://github.com/abhikorde31/ansible-examples
summary:by using ssh-keygen, we copy the public ip address of main_server i.e Ansible_server and paste in authorized_key of target_server.

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Jetbrains Survey

Calling all developers!

Participate in the Developer Ecosystem Survey 2025 and get the chance to win a MacBook Pro, an iPhone 16, or other exciting prizes. Contribute to our research on the development landscape.

Take the survey

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️