A few years ago, I tried using ansible to automate setup of PiHole. That did not go well because it's essentially a poorly coded hobby-level project. I've since switched to BIND (named) & it's fantastic implementation of DNZ RPZ[0].
One of my incomplete-but-functional quarantine projects tries to tackle this "raspberry pi project" problem: How to reproducibly set up these community-maintained projects, with homebrew-like simplicity.
[0]: https://dnsrpz.info/