Primary Pi-hole syncs lists to unlimited Secondary Pi-holes

I run six Pi-holes on three different networks at three different physical locations. I wanted all six Pi-holes to share the same blocklists, blacklists, whitelists, and regex files, but it was time-consuming to manually synchronize all of them.

I wanted to use Pi-hole's built-in web UI to manage only one set of lists on one Pi-hole -- and then securely synchronize an unlimited number of additional Pi-holes. I couldn't find an existing script that did exactly what I wanted... so I wrote one:

pihole-cloudsync allows you to use any Pi-hole on any network to act as the "Master" or "Primary." This is the only Pi-hole whose list settings you will need to manage using Pi-hole's web UI. The Primary Pi-hole then uses pihole-cloudsync in Push mode to upload its blocklist, blacklist, whitelist, and regex files to a private Git repository that you control (such as GitHub).

All other Pi-holes that you wish to keep synchronized use pihole-cloudsync in Pull mode to download the Primary Pi-hole's blocklist, blacklist, whitelist, and regex files from your private Git repository.

The script is designed to work with any Git repo that your Pi-holes have access to, but I have only personally tested it with GitHub.

Feedback, suggestions, bug fixes, and code contributions are welcome.


Nice work! Been looking a way to sync my pi-holes :+1:

1 Like

Thanks for your time and work, and also for the good documentation and easy to read script :+1:

1 Like

I've got this mostly working, but it seems that when I setup the cron entries they aren't updating to the repository, and the secondary pihole isn't downloading what's in the repository.I just noticed that the secondary pihole didn't have the right timezone and country set so I fixed that and am waiting for it to run on the next hour i set for it to go off, we will see if it works.

thanks for sharing. i will try this definitely.