This role Install AWS Systems Manager Agent
Features:
- Downloads and installs AWS System Manager Agent from AWS distribution package
- Rotate the Agent Log file
This role work on RedHat, CentOS, Amazon Linux, Debian and Ubuntu distributions
- RedHat
- 6
- 7
- 8
- CentOS
- 6
- 7
- 8
- Amazon Linux
- 1
- 2
- Ubuntu
- 16.*
- 18.*
- Debian
- jessie
- sid
- stretch
To see the compatibility matrix of Python vs. Ansible see the project Travis-CI build matrix
# possible values:
# - true
# - false
# default value: false
# notes:
# * set value to true when you want to update installed version
ssm_update: false
None
- hosts: servers
gather_facts: True
roles:
- role: christiangda.amazon_ssm_agent
vars:
ssm_update: true
- hosts: all
gather_facts: True
become: true
become_user: root
become_method: sudo
remote_user: ec2-user
roles:
- role: christiangda.amazon_ssm_agent
Inventory file sample (inventory)
[all]
10.14.x.y
10.14.v.z
[amazon-1]
10.14.x.y
[amazon-2]
10.14.v.z
How to used it
ansible-playbook my-playbook.yml \
--inventory inventory \
--private-key [~/location of my key.pem] \
--become \
--become-user=ec2-user \
--user ec2-user
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">=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 pip --upgrade
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 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
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 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: