Here in this blog post I will show you how to install Ansible on an AWS EC2 instance.
Bellow are the pre requisites
- Have an AWS account
- Spin and EC2 instance and connect to it via ssh or directly from your aws console .
For the purpose of this post I created an aws ubuntu instance.
After connecting to your instance run the commands bellow. This will make sure that your instance is up to get and that you got access to Ansible repos for install.
sudo apt update
sudo apt-add-repository -y ppa:ansible/ansible
Once the steps above are done, now you may get started with the real deal by installing Ansible with the command bellow
sudo apt-get -y install ansible
After that, Ansible will be installed on your instance . You can now check the version with the command below
ansible --version
You will get the version of ansible installed along with the path to the configuration file.
Since the main goal of using Ansible is to automate our resource provisioning process, we will need to have boto3 installed. To learn more about boto3 , check my other blog post here
To install boto 3, just make sure that your instance is up to date one more time and running the command bellow
sudo apt update
sudo apt install python3-boto3
Just to make sure, you can also check that boto is installed by running the commands bellow
Method 1: pip show boto3
Method 2: pip list
Method 3: pip list boto | greb boto
Let me know if you like it . I tried to make it as short as possible . Next will be how to automate the creation of EC2 instance using Ansible.
Like it?
Follow me on @asksouley
Top comments (0)