On 17. okt. 2017 23:15, Parth Patel wrote:
I am trying to run this simple task where I want to increment counter for
"{{ esb_name }}_ESB_?" like "ABC_ESB_01, ABC_ESB_02 .....etc" until the
loop is over. How do I do that ? I tried nested and other loops but was
not able to do it. Any suggestions ?
---
- hosts: fuseesbdomhosts[0]
remote_user: test
become: yes
become_method: sudo
tasks:
- debug:
msg: "./client -a 8101 -h localhost -u admin -p admin
'fabric:container-create-child --profile {{ esb_name }}_CAML_PRFL {{ item }} {{ esb_name
}}_ESB_?'"
with_items:
- "{{ groups['fuseesbdomhosts'] }}"
Not pretty, but you could try this
- debug:
msg: msg: "./client -a 8101 -h localhost -u admin -p admin
'fabric:container-create-child --profile {{ esb_name }}_CAML_PRFL {{
fuseesbdomhosts[item | int] }} {{ esb_name }}_ESB_{% if item | int > 9
%}{{ item }}{% else %}0{{ item }}{% endif %}'"
with_sequence: start=0 end={{ groups['fuseesbdomhosts'] | length -1 }}
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ed621dab-b468-7e95-fc6e-2da6bf6ba75d%40olstad.com.
For more options, visit https://groups.google.com/d/optout.