Suppose I have an array in ansible:
vars:
loopme: [\'somesing\', \'someothersing\']
concatenateme: \'constant\'
How do i iterate over t
You can use map
to apply regex_replace
filter to every element of your list and replace "end of string" ($
) with your constant:
- hosts: localhost
gather_facts: no
vars:
loopme: ['somesing', 'someothersing']
concatenateme: 'constant'
tasks:
- debug:
msg: "{{ loopme | map('regex_replace','$',concatenateme) | list }}"