Ansible Config File Update

Ticker

6/recent/ticker-posts

Ansible Config File Update

Question To manage all servers within the stack using Ansible, the Nautilus DevOps team is planning to use a common sudo user among all servers. Ansible will be able to use this to perform different tasks on each server. This is not finalized yet, but the team has decided to first perform testing. The DevOps team has already installed Ansible on jump host using yum, and they now have the following requirement:

On jump host make appropriate changes so that Ansible can use john as the default ssh user for all hosts. Make changes in Ansible's default configuration only —please do not try to create a new config.



Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍

Solution:  

1. Switch to Root user on jump server itself

thor@jump_host /$ sudo su -

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for thor:

[root@jump_host ~]#


2. Go through the ansible configuration file and add remote user as per the task    

[root@jump_host ~]# cat /etc/ansible/ansible.cfg |grep remote_user -B5

# SSH timeout

#timeout = 10

 # default user to use for playbooks if user is not specified

# (/usr/bin/ansible will use current user as default)

#remote_user = root

[root@jump_host ~]#

[root@jump_host ~]# vi /etc/ansible/ansible.cfg

[root@jump_host ~]#

[root@jump_host ~]# cat /etc/ansible/ansible.cfg |grep remote_user –B5

# SSH timeout

#timeout = 10 

# default user to use for playbooks if user is not specified

# (/usr/bin/ansible will use current user as default)

remote_user = yousuf

[root@jump_host ~]#



3. Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge




Post a Comment

0 Comments

Latest Posts

Kodekloud Server's Login Credentials