hmm....this seems a little bit sophisticated as the list of groups is much longer in reality as in my example code which has only 4, so this leads to a big variable mess. no way to reference the group names in any other way?
On Thursday, August 2, 2018 at 10:49:42 AM UTC+2, Kai Stian Olstad wrote: > > On 02.08.2018 08:13, [email protected] <javascript:> wrote: > > best would be a list like this: > > > > "itsv_hostgroup": {WBG,LNZ,...} > > Typo I guess list is is ["WBG","LNZ",...] > > > > - set_fact: > > itsv_hostgroup: "LNZ" > > cacheable: true > > when: (itsv_machine_serial.stdout is match "IBM,02781A6BX") or > > (itsv_machine_serial.stdout is match "IBM,02781A6CX") or > > (itsv_machine_serial.stdout is match "IBM,02781A6DX") > > To add just do this to all of them > > itsv_hostgroup: '{{ itsv_hostgroup | default([]) + ["LNZ"] }}' > > The default([]) is there so it doesn't fail when itsv_hostgroup is not > defined, it will then be set to a empty list []. > And the rest just add a element to the list. > > -- > Kai Stian Olstad > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/bec65fe2-30b2-4ac3-afc7-9863838eb067%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
