DEV Community

Cover image for 3.Configure Default SSH User for Ansible
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

3.Configure Default SSH User for Ansible

Lab Information

The Nautilus DevOps team aims to manage all servers within the stack using Ansible, utilizing a common sudo user across all servers. They plan to use this user for various tasks on each server. While this isn't finalized, they're starting with testing. Ansible is already installed on the jump host via yum. Here's the requirement:

On the jump host, modify the default configuration of Ansible to enable the use of siva as the default SSH user for all hosts. Ensure to make changes within Ansible's default configuration without creating a new one.

Lab Solutions

STEP-BY-STEP SOLUTION

1️⃣ Open the default Ansible configuration file

Run on the jump host:

sudo vi /etc/ansible/ansible.cfg
Enter fullscreen mode Exit fullscreen mode

2️⃣ Modify it to use siva

Add:

remote_user = siva

4️⃣ Save and exit

In vi:

:wq

5️⃣ Verify the change

Run:

ansible-config dump | grep -i remote_user

You should see:

remote_user (default) = siva

This confirms Ansible now uses siva as the default SSH user for all hosts unless overridden in inventory or playbooks.


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)