1. Login to Ansible management server/machine. Create SSH keys in Ansible host machine by executing the below command: (if you already have keys created, please skip this step)
enter three times..now you will see keys successfully created.
2. Execute the below command on Ansible management node and copy the public key content:
sudo cat ~/.ssh/id_ed25519.pub
copy the above output.
3. Now login to target node, execute the below command to open the file
sudo vi /home/ubuntu/.ssh/authorized_k
type shift A and then enter now
and paste the key in the above file. please do not delete any existing values in this file.
4. Now go back to Ansible mgmt node, do changes in /etc/ansible/hosts file to include the node you will be installing software. Make sure you add public IP address of target node as highlighted below in red color:
sudo vi /etc/ansible/hosts
[My_Group]
xx.xx.xx.xx ansible_ssh_user=ubuntu ansible_ssh_private_key_file=~
5. let's make sure Ansible Control node is able to connect to target node

cd ~/roles
sudo vi aws-infra-role/tasks/installJava21.yml
java -version
openjdk version "21.x.x"
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)

Join the Discussion
Have a question about this tutorial or need help with a lab? Share your questions and feedback below.
Post a Comment