technical skills grow

Responsive Ads Here

Saturday, June 3, 2023

Chapter 2 : install & configure ansible server nodes for manage inventory

 Setup Prerequisites
 

 Master server :-  server for Ansible Control Node
 Client Server :-  IP: 192.168.2.30 and 192.168.2.40

Step 1:- Install Ansible on Ubuntu on Master server

Choose the following methods for installing Ansible.
1. Using Pip

If you have python-pip installed in your system, use the following pip command.

[master@node ~]$sudo pip install ansible

2. Using Ubuntu apt repository

To install it from the apt repository, execute the following commands to install ansible.
 

[master@node ~]$sudo apt-add-repository -y ppa:ansible/ansible 

[master@node ~]$sudo apt-get update


[master@node ~]$sudo apt-get install -y ansible

To validate the installation, execute the following ansible command.

[master@node ~]$ansible --version

Configuring Ansible Inventory

 All the servers that have to be managed using Ansible are called Ansible hosts.
Configure ansible.cfg

Open /etc/ansible/ansible.cfg  file and add the following.


[master@node ~]$vi /etc/ansible/ansible.cfg

[defaults]
inventory = /etc/ansible/inventory.ini
host_key_checking = False


Configure Ansible Inventory :

[master@node ~]$vi /etc/ansible/inventory.ini

[dev]
192.168.2.30
192.168.2.40

Step 3 :Test Remote Connection Using Ansible Ad-Hoc 

[master@node ~]$ansible all -m ping

 192.168.2.30 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.2.40 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Note : Check confiured inventory list using the following command.

[master@node]#ansible-inventory --list -y

Click chapter 3: Performing Ad Hoc Commands with Ansible  

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts