bodsch.awscli
Ansible Role: awscli
This Ansible role sets up the AWS CLI tools.
If you set awscli_version
to latest
, this role will try to install the newest version.
Be careful using this, as new versions may not always be compatible!
The binaries will be installed under /usr/local/bin/aws_${awscli_version}
and linked to /usr/local/bin/aws
, allowing for safer downgrades.
The AWS CLI archive is saved on the Ansible controller and copied to the target system later.
You can choose a custom cache directory using the CUSTOM_LOCAL_TMP_DIRECTORY
environment variable.
By default, it is ${HOME}/.cache/ansible/awscli
.
If you prefer to download directly to the target system, set awscli_direct_download
to true
.
Requirements & Dependencies
Ansible Collections needed:
You can install them using:
ansible-galaxy collection install bodsch.core
ansible-galaxy collection install bodsch.scm
or
ansible-galaxy collection install --requirements-file collections.yml
Latest awscli
Version
Currently, there is only one old version (2.0.0).
You can check for the latest versions at GitHub.
Supported Operating Systems
Tested on:
- Arch Linux
- Artix Linux
- Debian-based systems:
- Debian 10 / 11 / 12
- Ubuntu 20.10 / 22.04
Note: RedHat-based systems are no longer officially supported. They might work, but not guaranteed.
Usage
awscli_version: 2.2.33
awscli_download_url: "https://awscli.amazonaws.com/awscli-exe-linux-x86_64{{ '' if awscli_version == 'latest' else '-' + awscli_version }}.zip"
awscli_archive: "aws-cli{{ '' if awscli_version == 'latest' else '-' + awscli_version }}.zip"
awscli_direct_download: false
awscli_config: "config.j2"
awscli_credentials: "credentials.j2"
awscli_users: {}
AWS Credentials
You can set multiple credentials for each user. Each user can have more than one profile.
Every profile that isn’t default
will have a corresponding profile prefix.
The following example creates config and credentials files:
cat /var/lib/jenkins/.aws/config
[default]
region = eu-central-1
output = json
[profile us-west]
region = us-west-1
output = text
cat /var/lib/jenkins/.aws/credentials
[default]
aws_access_key_id = molecule-aws-access-key-id
aws_secret_access_key = molecule-aws-secret-access-key
[us-west]
aws_access_key_id = molecule-aws-access-key-id_2
aws_secret_access_key = molecule-aws-secret-access-key_2
awscli_users:
jenkins:
profiles:
default:
region: "eu-central-1"
output: "json"
access_key_id: "molecule-aws-access-key-id"
secret_access_key: "molecule-aws-secret-access-key"
us-west:
region: "us-west-1"
access_key_id: "molecule-aws-access-key-id_2"
secret_access_key: "molecule-aws-secret-access-key_2"
home: "/var/lib"
group: "jenkins"
For details on using AWS Named Profiles, check this guide.
Contribution
Please refer to Contribution.
Development and Branches
The master
branch contains the latest features and might be unstable. For a stable version, use a Tagged Version.
Author
- Bodo Schulz
License
This software is free to use!
ansible-galaxy install bodsch.awscli