christiangda.amazon_ssm_agent

Rôle Ansible : christiangda.amazon_ssm_agent

Statut de la construction Rôle Ansible

Ce rôle installe l'agent AWS Systems Manager

Fonctionnalités :

  • Télécharge et installe l'agent AWS Systems Manager à partir du package de distribution AWS
  • Fait la rotation du fichier log de l'agent

Exigences

Ce rôle fonctionne sur les distributions RedHat, CentOS, Amazon Linux, Debian et Ubuntu

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

Pour voir la matrice de compatibilité de Python avec Ansible, consultez la matrice de construction Travis-CI

Variables du rôle

# valeurs possibles :
# - true
# - false
# valeur par défaut : false
# notes :
# * définir la valeur sur true lorsque vous voulez mettre à jour la version installée
ssm_update: false

Dépendances

Aucune

Exemple de Playbook

RedHat/CentOS, Ubuntu et 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

Exemple de fichier d'inventaire (inventory)

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

[amazon-1]
10.14.x.y

[amazon-2]
10.14.v.z

Comment l'utiliser

ansible-playbook my-playbook.yml \
    --inventory inventory \
    --private-key [~/emplacement de ma clé.pem] \
    --become \
    --become-user=ec2-user \
    --user ec2-user

Développement / Contribuer

Ce rôle est testé avec Molecule et a été développé en utilisant les environnements virtuels Python

Préparez votre environnement

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

Dépendances

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

Clonez le dépôt du rôle et créez un lien symbolique

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

Exécutez le test

Utiliser docker localement

molecule test [--scenario-name default]

Utiliser vagrant localement

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

ou

molecule test --scenario-name vagrant

De plus, si vous souhaitez tester en utilisant des machines virtuelles, j'ai un très joli projet ansible-playground qui utilise Vagrant et VirtualBox, essayez-le !

Licence

Ce module est publié sous la Licence Publique Générale GNU Version 3 :

Informations sur l'auteur

Installer
ansible-galaxy install christiangda.amazon_ssm_agent
Licence
gpl-3.0
Téléchargements
5.6k