Ansible setup lab 6:

Setup control node

  1. Pick one of the ec-2 instance we created in Lab 5 as control node

  2. Connect to the control node

  3. Switch to root user

$ sudo -i
#
  1. Update the package list

# yum update -y
  1. Create a new user ansible-user

# useradd ansible-user
# password ansible-user
# password123
  1. Add privileges to the user ansible-user

# usermod -aG wheel ansible-user
  1. Switch to that user

# su - ansible-user
$
  1. Now generate ssh keys

ssh-keygen
press enter three times to accept all the defaults.
  1. Now enable password based authentication

sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
systemctl restart sshd
  1. Now install Ansible

sudo amazon-linux-extras install ansible2 -y
  1. verify ansible Setup

ansible --version
  1. Create a folder in home directory i.e.

cd
mkdir ansible-dir
cd ansible-dir
touch hosts