christiangda.amazon_inspector_agent
Ansible Role: christiangda.amazon_inspector_agent
このロールはAWS Inspector Agentをインストールします。
特徴:
- AWS配布パッケージからAWS Inspector Agentをダウンロードしてインストールします
- エージェントログファイルをローテーションします
要件
このロールはRedHat、CentOS、Amazon Linux、Debian、Ubuntuディストリビューションで動作します。
- RedHat
- 6
- 7
- CentOS
- 6
- 7
- Amazon Linux
- 1
- 2
- Ubuntu
- 14.*
- 16.*
- 18.*
- Debian
- jessie
- stretch
PythonとAnsibleの互換性マトリックスはプロジェクトのTravis-CIビルドマトリックスを参照してください。
ロール変数
# 可能な値:
# - true
# - false
# デフォルト値: true
# 注意:
# * エージェントの自動更新を無効にする場合はfalseに設定します
# 参照: https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents.html#agent-updates
ia_auto_update: true
# 可能な値:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# デフォルト値: ""
ia_http_proxy: ""
# 可能な値:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# デフォルト値: ""
ia_https_proxy: ""
# 可能な値:
# - https://docs.aws.amazon.com/inspector/latest/userguide/inspector_agents-on-linux.html
# デフォルト値: "169.254.169.254"
# 注意:
# * AWSメタデータIP(169.254.169.254)のプロキシを常に無効にします
ia_no_proxy: "169.254.169.254"
依存関係
なし
例のプレイブック
RedHat/CentOS、Ubuntu、Debian
デフォルトの変数値を使用
- hosts: servers
gather_facts: True
roles:
- role: christiangda.amazon_inspector_agent
自動更新を無効にし、プロキシ設定を使用
- 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
インベントリファイルのサンプル(inventory)
[all]
10.14.x.y
10.14.v.z
[amazon-1]
10.14.x.y
[amazon-2]
10.14.v.z
使用方法
ansible-playbook my-playbook.yml \
--inventory inventory \
--private-key [~/my key.pemの場所] \
--become \
--become-user=ec2-user \
--user ec2-user
開発 / 貢献
このロールはMoleculeでテストされており、Python仮想環境を使用して開発されました。
環境の準備
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
依存関係
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
ロールリポジトリをクローンし、シンボリックリンクを作成
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
テストを実行
ローカルでdockerを使用
molecule test [--scenario-name default]
ローカルでvagrantを使用
molecule create --scenario-name vagrant
molecule converge --scenario-name vagrant
molecule verify --scenario-name vagrant
または
molecule test --scenario-name vagrant
さらに、VMを使用してテストする場合は、VagrantとVirtualBoxを使用した非常に素敵なansible-playgroundプロジェクトがありますので、ぜひ試してみてください!
ライセンス
このモジュールはGNU一般公衆ライセンスバージョン3の下でリリースされています:
著者情報
プロジェクトについて
Ansible Role for AWS Inspector Agent
インストール
ansible-galaxy install christiangda.amazon_inspector_agent
ライセンス
gpl-3.0
ダウンロード
289