/ansible-role-aws-sdk

Ansible role that will install the `boto` library (boto3 by default). Will install `pip` if absent.

Ansible Role: AWS SDK

Build Status

This role will install the boto library via pip. boto3 (the Python SDK recommended by Amazon AWS) is installed by default , while boto (version 2) is not. Note that a number of number of Ansible modules are still using version 2.

pip will be installed if absent, via the get-pip.py script (default) or thru the OS package managers.

Requirements

If using RedHat/CentOS, make sure you have the EPEL repository installed prior to using this role (you can install it using the geerlingguy.repo-epel role).

Role Variables

Optional variables

  • aws_sdk_boto3_version: Version of boto3 to install. If this variable is not provided, pip will install the latest listed in PyPI.
  • aws_sdk_boto_version: Version of boto (version 2) to install. If this variable is not provided, pip will install the latest listed in PyPI.

Default values (see defaults/main.yml)

aws_sdk_pip_use_package_manager: false

Pip will be installed using the get-pip.py script. If set to true, pip will install using apt (Debian) or yum (Red Hat).

aws_sdk_install_boto: false
aws_sdk_install_boto3: true

By default, boto3 will be installed but boto (version 2) will not. Most ansible modules are still using boto but not boto3.

Variables (see vars/main.yml)

aws_sdk_pip_script_url: https://bootstrap.pypa.io/get-pip.py
aws_sdk_tmp_script_path: /tmp/get-pip.py
aws_sdk_apt_cache_valid_time: 300    # Skip apt update if cache is less than 5 min.

Dependencies

None

Example playbook

- hosts: all
  roles:
    - gametize.aws-sdk

Tests

Travis tests (.travis.yml) are set up according to this article by geerlingguy.

Gitlab CI tests are set up similarly, but with more details. Tests can be run with gitlab-runner. Example of running this locally:

gitlab-ci-multi-runner exec shell test_centos7

License

MIT

Author Information

LIM EnSheng (ensheng@gametize.com)