AWSCli Installation & Configuration using Ansible

In this blog post, we’ll learn that how we can use simple Ansible role to install the AWS CLI with all the required dependencies on Ubuntu 14.04 LTS, it should work on other versions of Ubuntu too.

First, clone this Repository from the GitHub:

git clone

Note: If git is not installed then you can simply download the zip file.

To use this role, edit the site.yml file:

vi site.yml

Mentioned the AWSCli role:

 - hosts: server
   sudo: True
   gather_facts: True
    - awscli

After this, edit the hosts file and enter the ip of your remote server, on which you want to perform all these tasks:

vi hosts

In my case, it is


After that edit the vars/main.yml file:

Change the username(s), their default aws region, output format, aws access key and aws secret key but these user(s) must exist on the target system. Also change the other values as per your requirement. These are self explanatory.

Best option is to encrypt the variables file(vars/main.yml) by using the following command:

ansible-vault encrypt vars/main.yml

Then run this command, if you didn’t encrypt the variable in above mentioned step:

ansible-playbook -i hosts -u arbab site.yml


Note: Please don’t forget to change arbab with your username

Will start executing the tasks:


After successful completion of these tasks, it will show you the summary, something like this:


If you have encrypted the variables in above mentioned step, then run this command:

ansible-playbook --ask-vault-pass -i hosts -u arbab site.yml

4Note: Please don’t forget to change arbab with your username and enter the vault password that you have configured above.

Enjoy :-)

Hope this will help you!

Please Remember me in your prayers!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: