I always tell networking engineers attending our Building Network Automation Solutions online course to create minimalistic data models with (preferably) no redundant information. Not surprisingly, that’s a really hard task (see this article for an example) - using a simple automation tool like Ansible you end with either a messy and redundant data model or Jinja2 templates (or Ansible playbooks) full of hard-to-understand and impossible-to-maintain business logic.
Stephen Harding solved this problem the right way: his data center fabric deployment solution uses a dynamic inventory script that translates operator-friendly fabric description (data model) into template-friendly set of device variables.
That by itself would be no mean feat, but he went much further. His solution supports tenants, L3VNIs, L2VNIs, VLANs, single- or dual-homed interfaces, and per-tenant routing protocols… resulting in a solution pretty close to what those people who use Cisco ACI as VLAN manager do (warning: trolling detected, no need to react :D).
I would highly recommend you explore his solution, and I’m positive he won’t be upset if you improve it and submit a pull request ;)