On Sat, May 09, 2020 at 07:49:46AM +0200, Stefan Hornburg (Racke) wrote: > On 5/9/20 7:36 AM, Marc Haber wrote: > >>> Can a custom inventory plugin access what the previously running > >>> inventory plugins have parsed, and can it augment structure that was > >>> build by the predecessors? This way, I could have all processing power > >>> and flexibility of imperative programming. I could think of a gazillion > >>> of other places where this could be useful to simplify my templates > >>> _AND_ my inventory. > >>> > >>> Having this done inside ansible would allow me to take advantage of the > >>> inventory reading logic that is already present in ansible. I could > >>> write a preprocessor writing out the "augmented inventory" before > >>> ansible is started, but I'd have to manually process the inventory file > >>> -and- the contents of the host_vars and group_vars directories. I'd like > >>> to avoid this. > > > > Any idea whether this would work? > > You could also write a custom module in Python which can transform the > structure > as you wish. You can call your custom module in the first task to achieve the > augmenting.
_That_ sounds totally interesting, can you point me to some example code please? Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20200509064711.GB18228%40torres.zugschlus.de.
