I am passing docker image as an argument to ansible playbook. In the playbook, I need to grab the registry, repository names and tag into separate variables.
I am trying to use split filter.
- set_fact:
registry: "{{ source_image.split('/')[0] }}"
repo_and_tag: "{{ source_image.split('/')[1] }}"
- set_fact:
repo: "{{ repo_and_tag.split(':')[0] }}"
tag: "{{ repo_and_tag.split(':')[1] }}"
Instead of using split filter multiple times, is there any better way of doing this?
Thanks.