In Lab 5: Installing Ansible Server, participants typically concentrate on the installation and initial setup of Ansible, a powerful open-source automation tool. This lab involves installing the Ansible control node, which serves as the central server for managing configurations and orchestrating automation tasks. Participants may configure essential settings such as inventory files and connectivity parameters. Ansible, known for its simplicity and agentless architecture, allows users to control remote machines through SSH. The lab aims to provide hands-on experience in setting up the Ansible server, enabling participants to efficiently automate and manage configurations across their infrastructure. Successful completion of Lab 5 equips participants with the foundational skills needed to leverage Ansible as a versatile automation tool within their DevOps workflows.
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install epel-release-7.noarch.rpm –y
sudo yum update –y
sudo yum install git python python-devel python-pip openssl ansible –y
vi /etc/ansible/ansible.cfg
(Press i)
inventory = /etc/ansible/hosts (uncomment)
sudo\_user = root (uncomment)
(Press esc)
:wq!
vi /etc/ansible/hosts
(Press i)
\[groupname\]
machine name OR machine IP
(Press esc)
:wq!
adduser ansible (in all machines)
passwd ansible (in all machines)
visudo
(Press i)
ansible ALL=(ALL) NOPASSWD:ALL
(Press esc)
:wq!
vi /etc/ssh/sshd\_config
(Press i)
PermitRootLogin yes (uncomment line, set to yes)
PasswordAuthentication yes (uncomment line, set to yes)
PermitRootLogin no (comment)
PasswordAuthentication no (comment)
(Press esc)
:wq!
service sshd restart
su ansible -
whoami
sudo yum update
ssh <node-private-ip> (It prompts for password)
ssh key-gen (can see .ssh/both keys in same directory)
ssh-copy-id ansible@<node-private-ip\>
ssh <node-private-ip>