[ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-12-05 Thread Pieter Voet
OK, so I looked at Ansible's code, and I now know how to implement this. I tried my modification locally and it works fine. It basically adds a module that adds an 'extra_vars' variable if it does not yet exist. That way, any variable set on the commandline using the '--extra-vars'

[ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-11-30 Thread Pieter Voet
OK, redefining my testcase then : > > groupall = { host_a, host_b, host_c } > group1 = { host_x, host_y, host_a, host_z } group2 = { host_b, host_c } > > --- > - hosts: group1 > tasks: > - name: get the variable value > whatever_module: arg=arg_a > register: result > > -

Re: [ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-11-30 Thread Kai Stian Olstad
On 30.11.2016 11:50, Pieter Voet wrote: Hi Kai, you said : Knowledge of members in group1 you find with groups['group1'] hostvars[groups['group1'][0]]['result'] actually, the 'group1' group contains a lot of hosts.. There is no quarantee that the first entry in that array actually is the

[ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-11-30 Thread Pieter Voet
Hi Kai, you said : > Knowledge of members in group1 you find with groups['group1'] > hostvars[groups['group1'][0]]['result'] actually, the 'group1' group contains a lot of hosts.. There is no quarantee that the first entry in that array actually is the host that applies to my playbook. --

Re: [ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-11-30 Thread Kai Stian Olstad
On 30.11.2016 10:08, Pieter Voet wrote: True. And thanks for contributing. I knew this. I think I oversimplified my testcase... Thing is, our inventory has many groups, where hosts can be member of multiple groups.. Here's a modified testcase : groupall = { host_a, host_b, host_c }

[ansible-project] Re: Global variable to pas dynamic data between plays with different hosts

2016-11-30 Thread Pieter Voet
True. And thanks for contributing. I knew this. I think I oversimplified my testcase... Thing is, our inventory has many groups, where hosts can be member of multiple groups.. Here's a modified testcase : > > groupall = { host_a, host_b, host_c } > group1 = { host_a } group2 = {