I am trying to create rsa and copy to other remote machines so that test[0] is able to ssh into test[1] and test[2]
My inventory file
[ test ]
10.100.0.1
10.100.0.2
10.100.0.3
I want to create a rsa token on 10.100.0.1 as root user and copy the public key to /home/centos/.ssh/authorized_keys as root user to 10.100.0.2 and 10.100.0.3.
How can this be achieved using ansible. All the 3 instances are AWS -ec2 centos 7 machines. I want the code to be dynamic and not hard-coded ips.
I am unable to proceed further.
- name: Generate /etc/ssh RSA host key
command: ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""
args:
creates: /root/.ssh/vid_rsa
run_once: True