Skip to main content

Command Palette

Search for a command to run...

3.Configure Default SSH User for Ansible

Updated
2 min read
3.Configure Default SSH User for Ansible
T

Cloud & SRE specializing in AWS and DevOps. I share my ongoing learning journey through practical tutorials and insights. Let's grow together.

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

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.

More from this blog

W

Whispering Cloud Insights

88 posts

Documenting my path to cloud journey. Sharing lessons, tutorials, and insights from my continuous learning journey. Learn with me.