Thanks, Matt! On Tuesday, August 30, 2016 at 1:19:27 PM UTC-4, Matt Martz wrote: > > To my knowledge you cannot update hostvars directly from an action plugin, > primarily due to forking, and variable scope. If you do find a place where > you could modify hostvars, they don't modify the real hostvars, just a copy > of it. > > The way that `set_fact` works, is by returning `ansible_facts` in the > result, and the executor merges it into hostvars. Unfortunately > ansible_facts is per host, so if you are bypassing the host loop, all facts > will be set for all hosts, not just the host you want. > > On Tue, Aug 30, 2016 at 11:54 AM, Jim Ficarra <[email protected] > <javascript:>> wrote: > >> Anyone have some possible insight to this? Any thoughts are appreciated. >> >> Thanks! >> >> >> On Monday, August 22, 2016 at 4:56:34 PM UTC-4, Jim Ficarra wrote: >>> >>> Hi, >>> >>> I am building an ActionModule (bypassing the host loop) to query an >>> internal REST service that provides bulk metrics for a bunch of hosts at >>> once (for the hosts that are in play). After getting the data back from >>> the call, I want to then populate the hostvars of the hosts returned with >>> filtered items from the data that correspond to each host. The call is >>> made once to avoid repeated queries to the REST API. >>> >>> The ActionModule seems to work in the context of a single host. >>> Bypassing the host loop runs once, but adding data to the results simply >>> updates one of the hosts and not all. Is there an object exposed from the >>> ActionModule, base classes or embedded objects that will let me iterate >>> over each hosts' vars/facts and update them? >>> >>> Ansible Version: 2.1.0.0 and 2.1.1.0 >>> >>> Thanks in advance! >>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Matt Martz > @sivel > sivel.net >
-- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
