This role install AWS Command Line Interface (awscli)
The best wayt to install this role is using the command ansible-galaxy install christiangda.awscli
, the Ansible Galaxy repository is christiangda.awscli
The repository code is https://github.com/christiangda/ansible-role-awscli
Notes:
- This role does not allow to configure AWS CLI profile (config and credentials), instead, it works together with the role christiangda.awscli witch allow you configure it.
This role work on RedHat, CentOS, Debian and Ubuntu distributions
- RedHat
- 6
- 7
- 8
- CentOS
- 6
- 7
- 8
- Ubuntu
- 14.*
- 16.*
- 18.*
- 19.*
- Debian
- jessie (8)
- stretch (9)
- buster (10)
- sid (unstable)
To see the compatibility matrix of Python vs. Ansible see the project Travis-CI build matrix
None
- RedHat/CentOS
- 6/7 EPEL Repository You need to enable EPEL repository, you could use my role: christiangda.epel_repo for this task.
Note: RedHat/CentOS 8 doesn't need EPEL Repository to use this role.
When you have RedHat/CentOS 8 or Debian/Ubuntu target
- hosts: redhat-8
gather_facts: True
roles:
- role: christiangda.awscli
When you have RedHat/CentOS 6/7 target
- hosts: redhat-7
gather_facts: True
roles:
- role: christiangda.epel_repo
- role: christiangda.awscli
When you have multiples OS targets, install EPEL repository only in RedHat/CentOS 6/7
- hosts: servers
gather_facts: True
roles:
- role: christiangda.epel_repo
when: >
ansible_os_family == 'RedHat' and (
ansible_distribution == 'CentOS' or
ansible_distribution == 'RedHat'
)
and (
ansible_distribution_major_version == '6' or
ansible_distribution_major_version == '7'
)
changed_when: false
- role: christiangda.awscli
When you have RedHat/CentOS 8 or Debian/Ubuntu target and wants to use the role christiangda.awscli
- hosts: redhat-8
gather_facts: True
roles:
- role: christiangda.awscli
- role: christiangda.awscli_configure
vars:
awscliconf_files:
credentials:
- default:
aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE'
aws_secret_access_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
config:
- default:
region: us-west-2
output: json
- profile development:
role_arn: 'arn:aws:iam::123456789012:role/role-for-development'
mfa_serial: 'arn:aws:iam::11111111111:mfa/christian.gonzalez'
region: eu-west-1
source_profile: default
This role is tested using Molecule and was developed using Python Virtual Environments
Prepare your environment
- Python 3
mkdir ansible-roles
cd ansible-roles/
python3 -m venv venv
source venv/bin/activate
pip install pip --upgrade
pip install ansible
pip install molecule
pip install molecule[vagrant]
pip install selinux
pip install docker
pip install pytest
pip install pytest-mock
pip install pylint
pip install rope
pip install autopep8
pip install yamllint
pip install flake8
Clone the role repository and create symbolic link
git clone https://github.com/christiangda/ansible-role-awscli.git
ln -s ansible-role-awscli christiangda.awscli
cd christiangda.awscli
Execute the test
Using docker in local
molecule test [--scenario-name default]
Using vagrant in local
molecule create --scenario-name vagrant
molecule converge --scenario-name vagrant
molecule verify --scenario-name vagrant
or
molecule test --scenario-name vagrant
Additionally if you want to test it using VMs, I have a very nice ansible-playground project that use Vagrant and VirtualBox, try it!.
This module is released under the GNU General Public License Version 3: