wait_for_ip_address timeout in vmware_guest module

212 views
Skip to first unread message

Neil Watson

unread,
Jan 5, 2017, 12:08:03 PM1/5/17
to Ansible Project
Greetings,

I'm seeing evidence that the vmware_guest module does not wait long enough to get the guest's new IP. Is there a way to increase the wait time?

TASK [provision_vm_and_set_ip : Create VM from template] ***********************
changed: [vsphere_dcos1_bootstrap] => {"changed": true, "failed": false, "instance": {"hw_eth13": {"addresstype": "assigned", "ipaddresses": ["fe80::250:56ff:feab:83d6"], "label": "Network adapter 1", "macaddress": "00:50:56:ab:83:d6", "macaddress_dash": "00-50-56-ab-83-d6", "summary": "VM Network"}, "hw_guest_full_name": "CentOS 4/5/6/7 (64-bit)", "hw_guest_id": "centos64Guest", "hw_interfaces": ["eth13"], "hw_memtotal_mb": 2048, "hw_name": "dcos1_bootstrap", "hw_power_status": "poweredOn", "hw_processor_count": 1, "hw_product_uuid": "422bbd74-90a6-a0c2-7aee-159722b8884c", "ipv4": null, "ipv6": "fe80::250:56ff:feab:83d6", "module_hw": true}}
changed: [vsphere_dcos1_master2] => {"changed": true, "failed": false, "instance": {"hw_eth13": {"addresstype": "assigned", "ipaddresses": ["fe80::250:56ff:feab:5c0b"], "label": "Network adapter 1", "macaddress": "00:50:56:ab:5c:0b", "macaddress_dash": "00-50-56-ab-5c-0b", "summary": "VM Network"}, "hw_guest_full_name": "CentOS 4/5/6/7 (64-bit)", "hw_guest_id": "centos64Guest", "hw_interfaces": ["eth13"], "hw_memtotal_mb": 2048, "hw_name": "dcos1_master2", "hw_power_status": "poweredOn", "hw_processor_count": 1, "hw_product_uuid": "422b9843-43c5-b0ae-1172-ecb333bff0bb", "ipv4": null, "ipv6": "fe80::250:56ff:feab:5c0b", "module_hw": true}}
changed: [vsphere_dcos1_master1] => {"changed": true, "failed": false, "instance": {"hw_eth13": {"addresstype": "assigned", "ipaddresses": ["10.120.8.215", "fe80::250:56ff:feab:464f"], "label": "Network adapter 1", "macaddress": "00:50:56:ab:46:4f", "macaddress_dash": "00-50-56-ab-46-4f", "summary": "VM Network"}, "hw_guest_full_name": "CentOS 4/5/6/7 (64-bit)", "hw_guest_id": "centos64Guest", "hw_interfaces": ["eth13"], "hw_memtotal_mb": 2048, "hw_name": "dcos1_master1", "hw_power_status": "poweredOn", "hw_processor_count": 1, "hw_product_uuid": "422bd28d-35d6-349f-9424-81fc957d81cc", "ipv4": "10.120.8.215", "ipv6": "fe80::250:56ff:feab:464f", "module_hw": true}}
changed: [vsphere_dcos1_master3] => {"changed": true, "failed": false, "instance": {"hw_eth13": {"addresstype": "assigned", "ipaddresses": ["10.120.8.214", "fe80::250:56ff:feab:506e"], "label": "Network adapter 1", "macaddress": "00:50:56:ab:50:6e", "macaddress_dash": "00-50-56-ab-50-6e", "summary": "VM Network"}, "hw_guest_full_name": "CentOS 4/5/6/7 (64-bit)", "hw_guest_id": "centos64Guest", "hw_interfaces": ["eth13"], "hw_memtotal_mb": 2048, "hw_name": "dcos1_master3", "hw_power_status": "poweredOn", "hw_processor_count": 1, "hw_product_uuid": "422b853f-359e-a2b7-5e66-4f4e1536df5b", "ipv4": "10.120.8.214", "ipv6": "fe80::250:56ff:feab:506e", "module_hw": true}}

TASK [provision_vm_and_set_ip : set_fact] **************************************
ok: [vsphere_dcos1_bootstrap] => {"ansible_facts": {"new_vm": ""}, "changed": false}
ok: [vsphere_dcos1_master1] => {"ansible_facts": {"new_vm": "10.120.8.215"}, "changed": false}
ok: [vsphere_dcos1_master2] => {"ansible_facts": {"new_vm": ""}, "changed": false}
ok: [vsphere_dcos1_master3] => {"ansible_facts": {"new_vm": "10.120.8.214"}, "changed": false}

  - name: Create VM from template                                                
    vmware_guest
:                                                                
      validate_certs
: False                                                      
      hostname
: "{{ vcenter_hostname }}"                                        
      username
: "{{ vcenter_user }}"                                            
      password
: "{{ vcenter_pass }}"                                            
      name
:     "{{ vm_name }}"                                                  
      state
:    poweredon                                                        
     
template: "{{ vmtemplate }}"                                              
      folder
:   "{{ folder }}"                                                  
      disk
:                                                                      
       
- size_gb: 20                                                            
          type
: thin                                                            
          datastore
: "{{ datastore }}"                                          
      nic
:                                                                      
       
- type: vmxnet3                                                          
          network
: "{{ network }}"                                              
      datacenter
: "{{ esx_datacenter }}"                                        
      wait_for_ip_address
: True                                                  
   
register: newvm                                                              
                                                                                 
 
- set_fact:                                                                    
      new_vm
: "{{ newvm.instance.ipv4 }}"  

                                    
                                         

Neil Watson

unread,
Jan 5, 2017, 4:38:41 PM1/5/17
to Ansible Project

Neil Watson

unread,
Jan 6, 2017, 3:30:04 PM1/6/17
to Ansible Project

A  quick update on this. I set the timeout to 10min and I still get some host info with ipv4 set to null, even though the vm does have an ipv4 address. How can I work around this?
Reply all
Reply to author
Forward
0 new messages