Ansible contd
Password less authentication between servers
- Goal
- Steps:
- create a user called as devops and provide sudo permissions to devops (two servers)
sudo adduser devops - now create a ssh keypair
ssh-keygenon node 1 and copy the public key to node2ssh-copy-id - once we do this setup from node1 devops user can login into node2
ssh <node-2-ip>
- create a user called as devops and provide sudo permissions to devops (two servers)
AWS
- Lets create two ubuntu ec2 instances.
- In AWS we have a default user for ubuntu images
ubuntu - AWS EC2 instances will have password based access disabled.
- Lets enable password access and then perform above steps
- Modify
/etc/ssh/sshd_config.d/60-cloudimg-settings.confusing nano and set password authentication to yes - reload daemon & restart sshd
bash
sudo systemctl daemon-reload
sudo systemctl restart ssh
- Modify
- Now give full permissions to the devops user
sudo visudoand enter the following
devops ALL=(ALL:ALL) NOPASSWD:ALL
Azure
- Azure allows to set password while creating vms
- Lets create two vms in azure and while creating lets set the devops user
