On Wed, Apr 29, 2020 at 03:44:14PM -0700, Suresh Karpurapu wrote:
> Would anyone please help me formatting mountchk.result. I am able to get
> the required output with
> item.stdout_lines[0],item.stdout_lines[1],item.stdout_lines[2] but host3
> has 6 entries. So, please help me in filtering
You can use with_sequence or range in a for loop.
vars:
myvar:
- one
- two
- three
- four
- five
- six
tasks:
- debug: msg="{{ myvar[item | int] }},{{ myvar[item | int + 1] }},{{
myvar[item | int + 2] }}"
with_sequence: start=0 end={{ (myvar | length) - 1 }} stride=3
- debug:
msg: |
{% for i in range(0, myvar | length, 3) %}
{{ myvar[i] }},{{ myvar[i + 1] }},{{ myvar[i + 2] }}
{% endfor %}
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20200502090224.zygkso3iqpjok2bk%40olstad.com.