Requirements for all cluster VMs and administrator workstation.
Create new OS user for a ansible tasks on all cluster VMs:
Debian/Ubuntu
sudo adduser ansible
RedHat/Rocky
sudo useradd ansible
sudo passwd ansible
Add newly created user to sudoers file (for passwordless sudo):
sudo su -
echo -e "\n# Allow without a password\nansible ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
exit
Create required directory
mkdir -p ~/.ssh/
Generate new SSH key:
ssh-keygen -f ~/.ssh/id_rsa -N ""
chmod 700 ~/.ssh
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/authorized_keys
Distribute the SSH public key to all servers:
- use newly created user for ansible tasks:
ssh-copy-id ansible@127.0.0.11
SSH without password
ssh ansible@127.0.0.11