How to Install Ansible in Linux EC2
Step1 :
To launch a new instance, go to the AWS Console and search for EC2. Once you find it, click on EC2, then select “Instances” from the menu. Finally, click on “Launch Instances” to start the process.

Step 2:
In the “Name” section, you can enter the desired name for your instance. For example, you could use “MyFirstEC2Instance” or “WebAppServer”. Choose a name that best describes the function of the instance for easy identification later.

Step 3:
Then, select the Amazon Machine Image (AMI) as ‘LINUX’ since we are installing Ansible on a Linux system.

Step 4:
Select the instance type that suits your requirements. If you have an existing key pair, choose it from the dropdown. If you don’t have one, click on “Create new key pair” and follow the prompts to generate a new key pair for secure access to your instance.

Step 5 :
Name the key pair something memorable and relevant to your project. Once you’ve entered the name, click on “Create key pair” to generate it. Make sure to download the private key file and store it securely, as you’ll need it to access your instance later.

Step 6 :
Make sure to select the option to allow HTTP traffic. This is important if you plan to access your application over the web. You can typically do this by checking the box labeled “HTTP” in the inbound rules section of your security group settings.

Step 7 :
click on launch instance

Step 8:
The instance is now being created. You can monitor the progress in the management console. Once the status changes to “running”.

Step 9 :
Now Instance is created select the instance you want to connect.

Step 10 :
select the instance and click on connect

Step 11 :
click on connect

Step 12 :
Linux Instance is created. give the sudo su command to switch user .
$sudo su

Step 13 :
to install the ansible package in Linux
$yum install ansible -y

Ansible is installed on Linux ec2