Table of Contents
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
tasks:
- name: enable nginx
shell: amazon-linux-extras enable nginx1
- name: install nginx
yum:
name: nginx
state: latest
update_cache: yes
- name: start nginx
service:
name: nginx
state: started
A detailed Video Tutorial is given Below