How to Install Ansible in AWS and Manage servers Via Ansible

How to Install Ansible in AWS

Commands to Install Ansible in AWS EC2 are given below

sudo amazon-linux-extras enable ansible2
sudo yum install ansible 

ansible --version

How to Connect Master Instance to the Child instances

Set SSH Keys to Child Instances

The command to RUN via AWS Systems Manager is given below

echo "{ssh_key}" >> /root/.ssh/authorized_keys 

How to Install Nginx using Ansible Playbook

The Ansible Playbook Code is Given Below

- name: Update web servers
  hosts: web  
    - name: enable nginx 
      shell: amazon-linux-extras enable nginx1 
    - name: install nginx 
        name: nginx
        state: latest
        update_cache: yes
    - name: start nginx 
        name: nginx 
        state: started 

A detailed Video Tutorial is given Below

Atiqur Rahman

I am MD. Atiqur Rahman graduated from BUET and is an AWS-certified solutions architect. I have successfully achieved 6 certifications from AWS including Cloud Practitioner, Solutions Architect, SysOps Administrator, and Developer Associate. I have more than 8 years of working experience as a DevOps engineer designing complex SAAS applications.

Leave a Reply