DevOps Classroom notes 31/Oct/2024

Ansible configuration (password less)

  • Lets create two vms
  • create a user in ansible control node called as devops and same on node
sudo adduser devops
  • give admin permissions password less for devops
  • generate a key pair on ansible control node
  • copy the public key to the node
  • now try connecting using ssh without password
  • INstall ansible on control node and do what we did yesterday

AWS

  • On both node add user devops
sudo adduser devops
  • AWS will not allow password authentication by default, so we need to change the configuration rules
  • Change the value of PasswordAuthentication to yes in /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
  • restart sshd service
sudo systemctl restart ssh.service
  • We need to grant admin permissions to devops user
sudo visudo
  • Now add the following line
devops  ALL=(ALL:ALL) NOPASSWD:ALL
  • Now lets configure key based authentication between ansible control node and node 1
    • Switch to devops user su devops
    • Create a key pair ssh-keygen on ansible control node
    • Now copy the public key into node1 ssh-copy-id devops@<node-1-ip>
    • after this step we are up for passwordless authentication
  • Lets install ansible on ansible control node
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
  • Now create a hosts file and perform ansible ping test
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%