This can be done using loop_control.extended:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#extended-loop-variables

Examples:

    - debug:
        msg: "{{ ansible_loop.index0 }}: key: {{ item.key }}, value: {{
item.value }}"
      with_dict: "{{ thing }}"
      loop_control:
        extended: true

    - debug:
        msg: "{{ ansible_loop.index0 }}: key: {{ item.key }}, value: {{
item.value }}"
      loop: "{{ thing|dict2items }}"
      loop_control:
        extended: true

On Wed, Dec 18, 2019 at 8:09 AM Rafael Tomelin <[email protected]>
wrote:

> Hi,
>
> I have a task for creating the virtual machine at Azure with_dict.
>
> I should like to create a variable count (number the VMS) and put it
> with_dict.
>
> How can create loop count with with_dict?
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-984104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
> Red Hat Certified Engineer
> Puppet Professional 2017 Certification
>
> --
> 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/CAGEUqbBao7gxPbcJAr7Hb8%3DBSpb5gwHY8WnadLLPTuWZfrpc%2Bw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGEUqbBao7gxPbcJAr7Hb8%3DBSpb5gwHY8WnadLLPTuWZfrpc%2Bw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v8m10vnjS%2BbaO9h3dQdM8DBLo60cgyktBp-WN_XQ5Y2-A%40mail.gmail.com.

Reply via email to