Execute as the root user:
yum install -y sudo
Execute as the root user:
useradd -m hengshi
passwd hengshi #Set the login password for hengshi
Configure sudo privileges for system users.
Run as the root user:
visudo
Enter the following, save and exit:
hengshi ALL=(ALL) NOPASSWD: ALL
Assuming there are three machines in the cluster: Node-A, Node-B, Node-C. As the "running user (example hengshi)", perform the operations on each machine:
test -e ~/.ssh/id_rsa || { yes "" | ssh-keygen -t rsa -q -P ''; }
ssh-copy-id hengshi@localhost
ssh-copy-id hengshi@127.0.0.1
ssh-copy-id hengshi@Node-A
ssh-copy-id hengshi@Node-B
ssh-copy-id hengshi@Node-C
If there are machines with the same hostname, such as localhost, then you need to set it.
Assuming $name is the hostname for each machine:
sudo hostname $name
sudo su -c 'echo $name > /etc/hostname'
Edit the /etc/hosts file:
a.b.c.d1 Node-A
a.b.c.d2 Node-B
a.b.c.d3 Node-C
sudo yum install -y epel-release
sudo yum install -y ansible