christiangda.amazon_inspector_agent

Ansible-Rolle: christiangda.amazon_inspector_agent

Build Status Ansible Rolle

Diese Rolle installiert den AWS Inspector-Agent.

Funktionen:

  • Lädt den AWS Inspector-Agent aus dem AWS-Paket herunter und installiert ihn
  • Rotiert die Agent-Protokolldatei

Anforderungen

Diese Rolle funktioniert auf den Distributionen RedHat, CentOS, Amazon Linux, Debian und Ubuntu.

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

Um die Kompatibilität von Python und Ansible zu sehen, konsultieren Sie die Travis-CI-Baummatrix.

Rollenvariablen

# mögliche Werte:
# - true
# - false
# Standardwert: true
# Hinweise:
# * Setze den Wert auf false, wenn du das automatische Aktualisieren des Agenten nicht aktivieren möchtest
# Referenz: https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents.html#agent-updates
ia_auto_update: true
# mögliche Werte:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# Standardwert: ""
ia_http_proxy: ""
# mögliche Werte:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# Standardwert: ""
ia_https_proxy: ""
# mögliche Werte:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# Standardwert: "169.254.169.254"
# Hinweise:
# * Immer den Proxy für die AWS-Metadaten-IP (169.254.169.254) deaktivieren
ia_no_proxy: "169.254.169.254"

Abhängigkeiten

Keine

Beispiel-Playbook

RedHat/CentOS, Ubuntu und Debian

Mit Standardwerten

- hosts: servers
    gather_facts: True
    roles:
    - role: christiangda.amazon_inspector_agent

Automatische Aktualisierung deaktivieren und Proxy-Konfiguration verwenden

- hosts: servers
    gather_facts: True
    roles:
    - role: christiangda.amazon_inspector_agent
        vars:
            ia_auto_update: false
            ia_http_proxy: "192.168.2.253:3128"
            ia_https_proxy: "192.168.2.253:3128"
            ia_no_proxy: "169.254.169.254,192.168.2.1"

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_inspector_agent

Beispiel für eine Inventardatei (inventory)

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

[amazon-1]
10.14.x.y

[amazon-2]
10.14.v.z

Verwendung

ansible-playbook my-playbook.yml \
    --inventory inventory \
    --private-key [~/Pfad zu meinem key.pem] \
    --become \
    --become-user=ec2-user \
    --user ec2-user

Entwicklung / Beitrag

Diese Rolle wird mit Molecule getestet und wurde mit Python Virtual Environments entwickelt.

Bereiten Sie Ihre Umgebung vor

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 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

Abhängigkeiten

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 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

Klone das Rollen-Repositorium und erstelle einen symbolischen Link

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

Führe den Test aus

Mit Docker lokal

molecule test [--scenario-name default]

Mit Vagrant lokal

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

oder

molecule test --scenario-name vagrant

Wenn du zusätzlich mit VMs testen möchtest, habe ich ein sehr schönes ansible-playground-Projekt, das Vagrant und VirtualBox verwendet. Versuch es!

Lizenz

Dieses Modul wird unter der GNU General Public License Version 3 veröffentlicht:

Autor Informationen

Installieren
ansible-galaxy install christiangda.amazon_inspector_agent
GitHub Repository
Lizenz
gpl-3.0
Downloads
289