Project: Automating AWS with Ansible – Hello, Ansible!
Summary
AWS with Ansible through the “Hello, Ansible!” project. This hands-on guide will tell you installing Ansible in AWS EC2 instance and execute a “Hello, Ansible!” project. From this we will learn installing Ansible in AWS instance, file generation, and personalized message display.
Objectives
- Launching AWS EC2 Instance & EC2 Instance Connect
- Installing Ansible on AWS EC2 Instance
- Creating Ansible Playbook
- Executing Ansible Playbook
Steps
Step:1 Launching AWS EC2 Instances & EC2 Instance Connect
1.1 EC2 Instance Launch:
Start an AWS EC2 Instance and configure all the settings as shown below.
1.2 AWS EC2 Instance Connect:
Connect your EC2 Instance using EC2 Instance Connect
Step:2 Installing Ansible on AWS EC2 Instance
2.1 Installing Ansible:
After connecting to your EC2 Instance via EC2 Instance Connect, follow the below commands.
To Update system packages command:
sudo yum update -y
Command for installing Ansible:
sudo amazon-linux-extars install ansible2 -y
Command for verifying Ansible installation:
ansible --version
Step:3 Creating Ansible Playbook
3.1 Creating Directory
mkdir hello_ansible
cd hello_ansible
Create an Ansible Playbook “hello_ansible.yml”
3.2 Running the playbook
ansible-playbook hello_ansible.yml
Step:4 Executing Ansible Playbook
We will see the “Hello, Ansible!” message by the following the command below
cat/tmp/hello_ansible/Hello.txt
Top comments (0)