Ansible
Ansible is different from Puppet in that it is agentless.
Ansible can be set up and running without installing
software on each machine. This speeds time-to-value
for Ansible users. Also, Ansible uses the humanreadable data-serialization language YAML to define
installations. Different users find this to be either a
plus or a minus when compared to Puppet Script, and
since writing scripts is a big part of both tools’ usage,
it is worth determining the organization’s preference.
Also since its acquisition by Red Hat, Ansible now
offers tighter integrations to the Red Hat Enterprise
Linux (RHEL) stack that could make it a favorable
selection.
For organizations that have yet to adopt deployment
automation, it is worth the effort to look at all the
deployment automation tools and determine which
will work best for their enterprise. Many of these
automation tools are also capable of providing either a
complete CI, CD and ARA pipeline or integrations with
popular tools in that area.
Below is the enviorment, We will setup for ansible
[Asible Server] |192.0.0.20 ---------------- [Ansible Nodes] 192.0.0.30, 192.0.0.40
Lets start to setup Ansible:-
Step:1 Set EPEL repository
[root@server ~]# yum install epel-release -y
Step:2 Install Ansible using yum command
[root@server ~]# yum install ansible
[root@server ~]# ansible --version
Step:3 Setup keys based SSH authentication
[root@server ~]# ssh-keygen
#Use ssh-copy-id command to copy public key of Ansible server to its nodes.
Step:4 Define the nodes or inventory of servers for Ansible.
[root@server ~]# vi /etc/ansible/hosts
[my-servers]
192.168.1.9
192.168.1.10
Step:5 Now try to run the Commands from Ansible Server.
#Check the uptime of Ansible nodes
[root@server ~]# ansible -m ping 'my-servers'
# Adding a user to the nodes
[root@server ~]# ansible -m command -a "useradd amy" 'my-servers'
#Redirecting the output of command to a file
[root@server ~]# ansible -m command -a "df -Th" 'my-servers' > /command-output.txt
Now, You are ready to use ansible.