i required to create a list of paths but it is failing after first iteration
Given the variables for testing
center: "SSDC"
cluster: "server"
division: "div"
region: "reg"
env: "env"
app_id: "1234"
list_of_sequence: "{{ range(1, 10) }}"
Declare *path*, *prefix*, and *app*. You have to convert *app_id*
from string to integer because you quotes the number
path: "/ifs/{{ center }}/{{ cluster }}"
prefix: "{{ division }}{{ region }}{{ env }}"
app: "{{ '%05d' % (app_id|int) }}"
Use Jinja template to create the list
my_list: |
{% filter from_yaml %}
{% for i in list_of_sequence %}
- {{ path }}/{{ prefix|upper }}{{ app }}{{ '%02d' % (i) }}
{% endfor %}
{% endfilter %}
gives
my_list:
- /ifs/SSDC/server/DIVREGENV0123401
- /ifs/SSDC/server/DIVREGENV0123402
- /ifs/SSDC/server/DIVREGENV0123403
- /ifs/SSDC/server/DIVREGENV0123404
- /ifs/SSDC/server/DIVREGENV0123405
- /ifs/SSDC/server/DIVREGENV0123406
- /ifs/SSDC/server/DIVREGENV0123407
- /ifs/SSDC/server/DIVREGENV0123408
- /ifs/SSDC/server/DIVREGENV0123409