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.
brew install ansible python3
apt-get install ansible python3 python3-pip
pip3 install -r requirements.txt
cd src
python3 boto/get_inventory.py > hosts.txt
Update ansible.conf file if needed: ~/.ansible.conf
Example:
[defaults]
host_key_checking = False
retry_files_enabled = False
private_key_file = ~/.ssh/example.pem
nocows=1
Example using AnsiblePython:
python3 ansiblePython.py -p check-w.yml -v
python3 ansiblePython.py -p check-top.yml -v
python3 ansiblePython.py -p check-disk.yml -v
ansible-playbook -i hosts.txt check-os.yml -u ubuntu
ansible-playbook -i hosts.txt check-lamp.yml -u ubuntu
# ansible-playbook -i hosts.txt update-os.yml -u ubuntu
# ansible-playbook -i hosts.txt build-base-os.yml -u ubuntu
# ansible-playbook -i hosts.txt build-nagios-client.yml -u ubuntu
ansible default -i hosts.txt -m ping -u ubuntu
ansible default -i hosts.txt -a "w" -u ubuntu
ansible default -i hosts.txt -a "ps -ef" -u ubuntu
ansible default -i hosts.txt -a "netstat -ta" -u ubuntu
ansible-playbook -i hosts.txt check-user-load.yml -u ubuntu
ansible default -m setup -u ubuntu
Use --check
Use --syntax-check
Use --list-hosts
Make sure Python is installed on target hosts