Ansible Automation | How to create EC2 instance using Ansible Playbook in AWS | Ansible Tutorials

preview_player
Показать описание
Pre-requisites:
Ansible is installed and Boto is also installed on Ubuntu EC2 instance
Make sure you create an IAM role with AmazonEC2FullAccess policy and attach the role to EC2 instance.
Steps to create EC2 instance using Ansible:

Login to EC2 instance using Git bash or iTerm/putty where you installed Ansible. Execute the below command:

Create an Inventory file first

sudo mkdir /etc/ansible

Edit Ansible hosts or inventory file
sudo vi /etc/ansible/hosts

Add the below two lines in the end of the file:
[localhost]
local

cd ~
mkdir playbooks
cd playbooks

Create Ansible playbook
(copy the below content in green color)

now execute the ansible playbook by
Рекомендации по теме
Комментарии
Автор

Hello, for me im still getting the error No Handler was ready to Authenticate....
Im trying to start another ec2 and My inventory file consists of my target ec2 instance and [localhost]
My ec2 is Amazon Linux2023 (IMDv2 enabled)

But works fine if i set (IMDv2 optional)
Need to find a way to make it work even with IMDv2

shreyasdevarkar