I have the below playbook:
- name: Add hosts
include_tasks: "{{ playbook_dir }}/gethosts1.yml"
vars:
PROFILE_NUM: "{{ my_result }}"
loop: "{{ query('sequence', 'start=1 end='+(PROFILES)) }}"
loop_control:
loop_var: my_result
I run the playbook as:
ansible-playbook test.yml -e PROFILES=12
This gets me PROFILE_NUM as 1,2,3,4,5...12
However, i want PROFILE_NUM to be two digits i.e 01,02,03,04,05....12
I tried the following but it errors out PROFILE_NUM: "%02d{{ my_result }}"
Can you please suggest?