Ansible documentation: https://docs.ansible.com/ This setup is testet in my production enviroment. Please adjust to your own enviroment and preferences.
- Ubuntu 22.04
- Raspberry Pi v. [1, 2, 3, 4]
- Intel Nuc
- Arch Linux
- Generic laptop
Install OpenSSH and corresponding ssh-keys at your servers
sudo apt install openssh-server
Install Ansible
pacman -S ansible-core
Ajust hosts and ansible.cfg in /etc/ansible/ to your needs
Check if all the nodes listed in the inventory are alive by running the command below
$ ansible all -m ping
Dry run
$ ansible-playbook -K update_pb.yml --extra-vars="nodes=<HOST>" --check
Update server single node or group in HOST
$ ansible-playbook -K update_pb.yml --extra-vars="nodes=<HOST>"
Install with apt on server single node or group in HOST
$ ansible-playbook apt-install_pb.yml -K --extra-vars="nodes=<HOST>, package=<PACKAGE>"
Remove PACKAGE with apt on server single node or group in HOST
$ ansible-playbook apt-remove_pb.yml -K --extra-vars="nodes=<HOST>, package=<PACKAGE>"
Skip HOST in inventory group
$ ansible-playbook ping-all_pb.yml --limit '!<HOST>'
List the inventory in a "graph" way
$ ansible-inventory --graph -i hosts
Ansible {options] :
- -K -> elevate user calling sudo
- -l -> runs specific group from inventory file
- -i -> path to inventory file
- --check -> dry run
- --limit -> override og add spicific host to use with playbook
Free Software... But of Course!
Copyright [2023] [PeterWeissDK]
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.