Skip to content
AnsibleTools - Ansible Python Boto3 Automation
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
boto
reports
roles
.ansible.conf
.gitignore
README.md
_config.yml
ansiblePython.py
bootstrap_host.sh
build-base-os.yml
build-nagios-client.yml
check-disk.yml
check-lamp.yml
check-os.yml
check-top.yml
check-user-load.yml
check-w.yml
requirements.txt
update-os.yml

README.md

Ansible Tools

Bootstrap tools/examples for Ansible infrastructure DevOps automation. Shows some of the simple concepts and also includes some Python Boto3 examples.

Ansible and Python can be used together to get more power and control.

Examples use Python3 but older versions should be supported.

MacOS Install

brew install ansible python3

Debian Install

apt-get install ansible python3 python3-pip

Generate Inventory

pip install -r requirements.txt

python boto/get_inventory.py > hosts.txt

Update any key files in ~/.ansible.conf see example

Host inventory file

Example using Ansible and Python together

python ansiblePython.py -p check-w.yml -v

python ansiblePython.py -p check-top.yml -v

python ansiblePython.py -p check-disk.yml -v

Ansible Commands

ansible default -m ping -u ubuntu

ansible default -a "w" -u ubuntu

ansible default -a "ps -ef" -u ubuntu

ansible default -a "netstat -ta" -u ubuntu

Best Practices

Use --check

Use --syntax-check

Use --list-hosts

Get Facts

ansible default -m setup -u ubuntu

Simple Playbooks (single file)

ansible-playbook check-user-load.yml -u ubuntu

Run Role Playbooks (roles directory)

ansible-playbook check-lamp.yml -u ubuntu

ansible-playbook check-os.yml -u ubuntu

ansible-playbook update-os.yml -u ubuntu

ansible-playbook build-base-os.yml -u ubuntu

ansible-playbook build-nagios-client.yml -u ubuntu

Resources

https://www.ansible.com

http://docs.ansible.com

You can’t perform that action at this time.