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

Описание к видео Ansible Automation | How to create EC2 instance using Ansible Playbook in AWS | Ansible Tutorials

https://www.coachdevops.com/2024/01/a...
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
sudo vi create-ec2.yml
(copy the below content in green color)
edit the create-ec2.yml to make sure you update the key, AMI and region code which is red marked below:

now execute the ansible playbook by
ansible-playbook create_ec2.yml

Комментарии

Информация по комментариям в разработке