I am passing the following list to my script as an extra var
ansible-playbook /home/ec2-user/ansible/start.yml --extra-vars multi_config=['aa|111','bb|222','cc|444']
This is the only way I found to pass variables that contain a list or key/values (with the | separator) and I can't use json file as argument...
I'd like to loop this multi_config list and search for the element that contains "bb" and set it to a variable with set_fact to use it later.
I can load the list like this:
- name: set multi_config
set_fact:
multi_config: "{{ multi_config}}"
when: multi_config is defined
But how can I extract the element that contains "bb"?