Day 57: Ansible Hands-on with Video

ยท

2 min read

Day 57: Ansible Hands-on with Video

Table of contents

No heading

No headings in the article.

Today, let's embark on an exciting journey into the world of Ansible through a hands-on video tutorial! ๐ŸŽฌโœจ

Video Link: https://youtu.be/SGB7EdiP39E?si=fUA3_Th_R4JJOJPM

Task 01: Exploring Ansible Installation and Setup

  1. Create an EC2 Instance: Launch a new EC2 instance on AWS to serve as our Ansible master node.

  2. Connect via SSH: Access your EC2 instance using SSH to establish a connection.

  3. Add Ansible PPA Repository: Add the Ansible PPA repository to your system using the command:

    sudo apt-add-repository ppa:ansible/ansible

  4. Update and Install Ansible: Update the package list and install Ansible using the following commands:

    sudo apt update

    sudo apt install ansible

  5. Verify Ansible Version: Confirm the successful installation of Ansible by checking its version:

    ansible --version

  6. Launch Additional EC2 Instances: Create two new EC2 instances with the same private key as the Ansible master node.

  7. Configure SSH Access: Copy the private key to the Ansible master server and set up SSH access to the new instances.

  8. Create Inventory File: Set up an inventory file for Ansible by creating a hosts file inside the ansible folder. Add the IP addresses of the new servers to the hosts file.

  9. Verify Inventory: Use the ansible-inventory command to verify the inventory of hosts:

    ansible-inventory --list -y -i /path/to/inventory-file

  10. Ping Command Test: Test connectivity to the new nodes by running a ping command using Ansible.

  11. Resolve SSH Authentication Issues: If encountering SSH authentication errors, ensure correct permissions on the private key file and specify the private key file path in the Ansible command:

    ansible -i /path/to/inventory-file all -m ping --private-key=/path/to/private-key

Additional Ad-hoc Commands

  • Check Memory Usage:

    ansible -i /path/to/inventory-file all -a "free -m" --private-key=/path/to/private-key

  • Check Uptime:

    ansible -i /path/to/inventory-file all -a uptime --private-key=/path/to/private-key

By following these steps and exploring Ansible in action, you'll gain invaluable insights into automation and configuration management. Stay tuned for more hands-on sessions and unleash the full potential of Ansible in your infrastructure management journey! ๐Ÿ’ป๐Ÿ”ง #DevOps #Ansible #Automation #ConfigurationManagement #HandsOnTutorial ๐Ÿš€โ˜๏ธ

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future.

You can connect with me at: https://www.linkedin.com/in/davendersingh/

ย