top of page
Writer's pictureMukesh Chanderia

TERRAFORM

Lab Setup


Create three VMs of CentOS.


One will act as a controller and the rest two as workers.


Install ansible


rpm -qa | grep ansible


yum install ansible* - y


Step1: Ensure all three can communicate with each other.


Step2: Create "nmcli connection" on all three i.e. ansible-controller, worker1 & worker2


nmcli connection add con-name ansible-controller ifname ens33 type ethernet autoconnect yes


nmcli connection show


nmcli connection up ansible-controller


hostnamectl set-hostname ansible-controller


Step 3: Create DNS entry


vim/etc/hosts --> Create host entry for DNS


ansible-controller --> 10.0.0.1/24


Worker1 --> 10.0.0.2/24


Worker2 --> 10.0.0.3/24


Step 4: Find inventory file


ansible --version


config file = /etc/ansible/ansible.cfg


Go in config file to /etc/ansible/hosts and create host entry for worker.


10.0.0.2

10.0.0.3


Also, you may create group


[ web-server ]

10.0.0.2

[App-server]

10.0.0.3


Note: If username and password is defined in inventory file then it's else system will prompt for it.


List hosts present for ansible


ansible all --list --hosts









10 views0 comments

Recent Posts

See All

Comments


bottom of page