The purpose of this repo is to gather all my knowledge and build up a small library of repetative work I do with Ansible. The idea is to get better over time and do more complex configurations while saving a lot of time.
What is really nice about Ansible is that you can use Python to do more scripted and complex work.
A great way to manage and also automate tasks with Ansible is to use Ansible Semaphore.
brew install ansible
Rename the inventory.yml.example
file to inventory.yml
and setup all the hosts as indicated in the template.
To get a list of the inventory hosts.
ansible-inventory -i inventory.yml --list
To test the inventory you can run the following commands.
ansible all -i inventory.yml -m ping
To run playbooks against hosts without having to enter the password over and over, you can setup a passwordless ssh key login using the command below from the host you are planning to run ansible from.
ssh-copy-id {ip/host address}
ansible-playbook playbooks/update-ubuntu-server.yml -i inventory.yml -K
ansible-playbook playbooks/update-pi-hole.yml -i inventory.yml -K
ansible-playbook playbooks/update-proxmox-node.yml -i inventory.yml -K
The -K
option will allow for the sudo
user password to be prompted for each
host in the inventory.
- https://docs.ansible.com/
- https://www.ansible.com/
- https://www.digitalocean.com/community/tutorials/how-to-set-up-ansible-inventories
Anyone can contribute by submitting a pull request and you are welcome to use the repo in any way you like.
- Find a way to automate Ansible tasks from a trusted host and user.
- Create an inventory template file for a single host. Have all the inventory options available and uncomment only the ones you need.
- Document automation options with make file, cron jobs etc.
- Document simpler commands to quickly run a playbook on a specific host to setup something like docker.
- Playbook which changes passwords for a large number of machines when a user exists. https://www.howtouselinux.com/post/change-user-password-with-ansible
- Ubuntu, setup unattended updates with email notifications.
- Ubuntu, setup secure firewall.