Re: [ansible-devel] Support for functions for complex expressions

2022-07-14 Thread Brian Coca
Mostly i was thinking for the use of in templates, the only other thing i can think of is using 'intermediate vars' to keep reusable expressions and then creating their input when needed: - play: vars: merged_list: "{{ (lookup('vars', *query('varnames', merge_pattern$')) +

Re: [ansible-devel] Support for functions for complex expressions

2022-07-13 Thread Roy Lenferink
Thanks for the link Brian! I experimented a bit with macros but couldn't find a working solution. These are the lines I would like to have available in a macro: https://github.com/rlenferink/ansible-function-test/blob/9c83a40a29eb616a59b4da713771545a2aa44f32/playbook.yml#L15-L16 Knowing that

Re: [ansible-devel] Support for functions for complex expressions

2022-07-13 Thread Brian Coca
Jinja2 has this already, macros https://jinja.palletsprojects.com/en/2.10.x/templates/#macros -- -- Brian Coca -- 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,

[ansible-devel] Support for functions for complex expressions

2022-07-12 Thread Roy Lenferink
Hi all, Ansible has a lot of options, where combining and chaining filters is of great usage. In certain cases the final result might become a bit hard to maintain if it is re-used in multiple places. E.g. take the following examples: *merged_list: "{{ (lookup('vars', *query('varnames',