christiangda.amazon_ssm_agent

Ansible Role: christiangda.amazon_ssm_agent

Build Status Ansible Role

This role installs the AWS Systems Manager Agent.

Features:

  • Downloads and installs the AWS Systems Manager Agent from AWS.
  • Rotates the Agent log file.

Requirements

This role works on RedHat, CentOS, Amazon Linux, Debian, and Ubuntu.

  • RedHat: 6, 7, 8
  • CentOS: 6, 7, 8
  • Amazon Linux: 1, 2
  • Ubuntu: 16., 18.
  • Debian: jessie, sid, stretch

For compatibility between Python and Ansible, see the Travis-CI build matrix.

Role Variables

# possible values:
# - true
# - false
# default value: false
# notes:
# * set this to true if you want to update the installed version
ssm_update: false

Dependencies

None

Example Playbook

RedHat/CentOS, Ubuntu, and Debian

- hosts: servers
    gather_facts: True
    roles:
        - role: christiangda.amazon_ssm_agent
            vars:
                ssm_update: true

Amazon Linux 1/2 (my-playbook.yml)

- hosts: all
    gather_facts: True
    become: true
    become_user: root
    become_method: sudo
    remote_user: ec2-user
    roles:
        - role: christiangda.amazon_ssm_agent

Sample Inventory File (inventory)

[all]
10.14.x.y
10.14.v.z

[amazon-1]
10.14.x.y

[amazon-2]
10.14.v.z

How to Use It

ansible-playbook my-playbook.yml \
    --inventory inventory \
    --private-key [~/location of my key.pem] \
    --become \
    --become-user=ec2-user \
    --user ec2-user

Development / Contributing

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 --upgrade pip
pip install ansible
pip install "molecule>=2.22rc1"
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

Python 2.7

Dependencies

sudo dnf install redhat-rpm-config
sudo dnf install python-devel
sudo dnf install libselinux-python
mkdir ansible-roles
cd ansible-roles/

python2.7 -m virtualenv venv
source venv/bin/activate
pip install --upgrade pip
pip install ansible
pip install "molecule>=2.22rc1"
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 a Symbolic Link

git clone https://github.com/christiangda/ansible-role-amazon-ssm-agent.git
ln -s ansible-role-amazon-ssm-agent christiangda.amazon_ssm_agent
cd christiangda.amazon_ssm_agent

Run Tests

Using Docker locally:

molecule test [--scenario-name default]

Using Vagrant locally:

molecule create --scenario-name vagrant
molecule converge --scenario-name vagrant
molecule verify --scenario-name vagrant

or

molecule test --scenario-name vagrant

If you want to test using VMs, check out my ansible-playground project using Vagrant and VirtualBox.

License

This module is available under the GNU General Public License Version 3:

Author Information

Informazioni sul progetto

Ansible Role for AWS Systems Manager Agent (SSM Agent)

Installa
ansible-galaxy install christiangda.amazon_ssm_agent
Licenza
gpl-3.0
Download
5.6k