On 5/9/20 8:47 AM, Marc Haber wrote:
> 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?
> 

I don't have a custom module around which I could share here. Searching the web
for "ansible custom module" should give you plenty of insights though.

Regards
           Racke

-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/4ad0b9a6-dad0-1a21-ab16-5b997551e7b0%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to