I have configured this list as a variable:
my_list:
- name: whatever
url: http://example.com
- name: dummy
url: http://example.com
Can I configure a variable based on a name in my_list? Something I've tried, but fails because the variable doesn't loop over the list:
other_list:
- a_name: "{{ ip_list.name if my_list.name == 'whatever' }}"
a_url: "{{ ip_list.url if my_list.name == 'whatever' }}"
The expected outcome would be:
other_list:
- a_name: whatever
a_url: http://example.com
I don't want to run Ansible to set the variable during runtime, but I'd rather configure these variable in the variable files.