Reputation: 79
I have playbook which deploy vitrual machine. I want delay run playbook until vm get ip-address. I try make loop but have error.
tasks:
- vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
guest: "{{ inventory_hostname }}"
vmware_guest_facts: yes
validate_certs: no
register: vsphere_facts
until: vsphere_facts.ansible_facts.hw_eth0.ipaddresses[0] = "192.168.250.*"
retries: 20
delay: 60
{"failed": true, "msg": "The conditional check 'vsphere_facts.ansible_facts.hw_eth0.ipaddresses[0] = \"192.168.250.\"' failed. The error was: template error while templating string: expected token 'end of statement block', got '='. String: {% if vsphere_facts.ansible_facts.hw_eth0.ipaddresses[0] = \"192.168.250.\" %} True {% else %} False {% endif %}"}
Upvotes: 1
Views: 396
Reputation: 68269
You should opt for:
until: vsphere_facts.ansible_facts.hw_eth0.ipaddresses[0] | match("192.168.250.")
Direct comparison (with ==
) can't handle wildcards like *
.
Upvotes: 3