It's certainly possible. I used Chef for this. And spent a few years maintaining a pretty nice cookbook for a small startup.
Then tried to use Ansible to setup and maintain an OpenStack cluster. Biggest hell no so far I found in "orchestration and config management". It was a big ball of yikes and anti-patterns, plus it was extremely slow, brittle and hard to debug.
Is this Ansible's fault? No, of course not. But it's no wonder k8s seems the way forward. Having an active system that checks and maintains state and appropriate abstractions to describe apps, services, containers, volumes, network, etc. is easier than to write really idempotent playbooks.