On 6/15/20 9:39 PM, Rafael Tomelin wrote:
> 
> Hi guys,
> 
> I have a task with equal below, but when I validate it is defined it not 
> recognized.
> - name: include vars virtual_machine
> include_tasks: virtual_machine.yml
> when:
> - gms_az_vm_action == 'create_virtual_machine'
> - virtual_machine is defined
> loop: "{{ virtual_machine|dict2items }}"
> 
> 
> 
> How I do for doesn't read loop and not stop playbook when virtual_machine not 
> defined?

  loop: "{{ virtual_machine | default({}) | dict2items }}"

This produces an empty dict ({}) if virtual_machine is undefined and the loop 
goes over zero iterations.

Regards
        Racke

> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGEUqbAv4tEJoSWWU7TR9YP3x%2B5BzVDO6NmS7rZCGYhEHN_ocg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGEUqbAv4tEJoSWWU7TR9YP3x%2B5BzVDO6NmS7rZCGYhEHN_ocg%40mail.gmail.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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/e75a094d-15de-600d-dbc0-22b5dc8ab93f%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to