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].
[0]: https://dnsrpz.info/