DevOps Classroomnotes 30/Jul/2022

Ansible Installation and configuration

  • Lab Setup:
    Preview

For AWS Users:

  • Create two ubuntu 20.04 instances
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
  • AWS machines have passwords disabled by default. So lets enable password
In this /etc/ssh/sshd_config  => PasswordAuthentication no => yes
# Restart sshd service
sudo systemctl restart sshd

Preview
* Lets create a user called as devops with password as devops on both Anisble control Node and Node-1

sudo adduser devops
  • Now logout and check for password authentication.
  • Lets add sudo permissions for devops user.
# login as ubuntu user
sudo visudo 

Preview
Preview
* Lets do the same setup on the node 1
* enable password authenticat
* create a devops user
* add this user for sudo permissions without prompting for password.
* Login into ansible control node and install ansible Refer Here for the official documentation and Refer Here for installation steps

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
ansible --version

Preview
Preview
* Now lets create a inventory file called as hosts

172.31.35.153

Preview

For Azure Users:

  • Create two ubuntu vms in the same resource group
  • Since we can set the username and password during creation lets use the same user for ansible
  • On the node and ansible control node lets disable password prompt while executing sudo commands
sudo visudo
  • Install ansible on the control node
    Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner