We can install the AWS Ansible Collection in two different ways, depending on
the system we use. On Red Hat Enterprise Linux (RHEL) or CentOS, we can add a
new RPM repository and install packages using yum
or dnf
. On other
distributions, we can use ansible-galaxy
command for installation.
We need to install the boto3
python package separately in both
cases.
NOTE: To use AWS Ansible Collection, we need to have Ansible 2.9+ installed. Previous Ansible versions do not support Ansible Collections well enough to be usable.
To add the AWS Ansible Collection repository to RHEL or CentOS, we need to
create a new file called /etc/yum.repos.d/steampunk-aws.repo
and fill it
with the following content:
[steampunk-aws]
name=steampunk-aws
baseurl=https://steampunk.si/repos/rhel/$releasever/
enabled=1
Once we have done this, we can install the AWS Ansible Collection by running:
$ sudo yum install --nogpgcheck aws-ansible-collection # For RHEL and CentOS 7
$ sudo dnf install --nogpgcheck aws-ansible-collection # For RHEL and CentOS 8
To test the installation, we can run the next command:
$ ansible-doc steampunk.aws.ec2_instance
This should print out documentation for the EC2 instance module.
If we are not using any of the supported distributions, we can install the AWS Ansible Collection by running:
$ ansible-galaxy collection install https://steampunk.si/galaxy/steampunk-aws-0.8.4.tar.gz
To verify the installation, we can run
$ ansible-doc steampunk.aws.ec2_instance
If the previous command printed out the API documentation, we are all set.
In order to be able to use all of the AWS Ansible Collection features, we also need to install boto3 python package. We can do this using the following command:
$ pip3 install --user -U boto3
Now we can use all of the AWS features that collection supports.