- Install Ansible. The easiest way (especially on Pi or a Debian system) is via Pip:
- (If on Pi/Debian):
sudo apt-get install -y python3-pip
- (Everywhere):
pip3 install ansible
- (If on Pi/Debian):
- Clone this repository:
git clone https://github.com/geerlingguy/internet-pi.git
, then enter the repository directory:cd internet-pi
. - Install requirements:
ansible-galaxy collection install -r requirements.yml
(if you seeansible-galaxy: command not found
, restart your SSH session or reboot the Pi and try again) - Make copies of the following files and customize them to your liking:
example.inventory.ini
toinventory.ini
(replace IP address with your Pi's IP, or comment that line and uncomment theconnection=local
line if you're running it on the Pi you're setting up).example.config.yml
toconfig.yml
- Run the playbook:
ansible-playbook main.yml
If running locally on the Pi: You may encounter an error like "Error while fetching server API version". If you do, please either reboot or log out and log back in, then run the playbook again.
Visit the Pi's IP address (e.g. http://192.168.1.10/) and use the pihole_password
you configured in your config.yml
file. An existing pi-hole installation can be left unaltered by disabling the setup of this proyect's installation in your config.yml
(pihole_enable: false
)
To upgrade Pi-hole to the latest version, run the following commands:
cd ~/pi-hole #
docker-compose pull # pulls the latest images
docker-compose up -d --no-deps # restarts containers with newer images
docker system prune --all # deletes unused images