Great shout-out to @nitzmahone for the work he has done on making macros finally great in Ansible. Just seen the presentation today at CfgMgmtCamp 2026 (online for me, unfortunately) and was really surprised. I obviously did not pay close attention to this thread and to this line in particular:
but when Matt said “… it’s returning the macro function” during the presentation it just blew my mind… and everything became clear. It felt like something I’ve waited for years and finally got. I’ve tried several different approaches in making macros first class citizens in my code, including the way to distribute them, but it always felt reeeeaaaly ugly. This way of defining and using macros is way more practical. The only downside is that it is not compatible with versions of Ansible older than 2.19.
Anyway, you can check the whole presentation here: