Write a Blog explanation for the Ansible video
Firstly, launch an EC2 master instance.
Select the instance and click on 'Image and templates' and then 'Launch more like this'.
Enter the name and no of instances and click on 'Launch instance'.
Connect the master server and run the below commands to install Ansible.
sudo apt update sudo apt install ansible
Copy the downloaded private key.
Go to the .ssh folder create a key file and paste the copied key into this file.
We can now connect to any 3 servers by using the below commands.
sudo ssh -i ~/.ssh/ansible-key ubuntu@ip-address
Let's create a host file and add server info to this file.
We can verify the inventory of hosts using the ansible-inventory command.
ansible-inventory --list -y -i <inventory-file-path>
Give permissions to the key file by using the chmod command.
Ping to the server with the key file by using this command
ansible all -m ping -i <inventory_file> --private-key=<path_to_private_key>
Let's check the free memory or memory usage of servers by using this command.
ansible all -a "free -h" -i <inventory_file> --private-key=<path_to_private_key>
Thank you for reading!!
~Shreya Gupta
Great initiative by the #trainwithshubham community. Thank you Shubham Londhe
#devops #90daysofdevops #ansible