Recently I had to write templates containing somewhat long filter pipelines. Part of the logic involved lookuping current output of the pipeline in a dictionary (hostvars) and then extracting the value of a field of the resulting dictionary. In order to keep things decoupled I wrote two almost trivial plugins <https://gist.github.com/ValFadeev/9bf421fc1262c9ec7e31>. Here an example:
- name: find another host to join to form a cluster (e.g. Consul) set_fact: host_to_join: > {{ groups['my_group'] | difference([inventory_hostname]) | list | random | find_in(hostvars) | get_key('ec2_private_ip_address') }} Just wondering whether there are other existing ways of achieving the same result, with/without plugins, as surely someone must have faced a similar task. Thanks Valentin -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0b9c36de-08e3-41df-a21c-1d2e8df19e1b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.