@Mathias,  as an aside, what version of Ansible are you running?  I ask 
because the vmware_guest module is available as of 2.2 as a replacement of 
this module.  

On Friday, November 11, 2016 at 11:14:24 AM UTC-5, Mathias Waack wrote:
>
> We use cloning to create new VMs in our vsphere cluster. The template is 
> usually powered on (to receive regular updates), so we power it off before 
> we create a clone: 
>
>   - name: power off the template
>     vsphere_guest: 
>       vcenter_hostname: "{{ vcenter }}"
>       username: "{{ user }}"
>       password: "{{ pass }}"
>       guest: "{{ template }}"
>       validate_certs: False
>       state: powered_off
>       force: yes       
>
>   - debug: msg="template state is {{ hw_power_status }}."
>
>   - name: ensure the template is powered off
>     assert: { that: hw_power_status == "POWERED OFF" }
>
>  This used to work for VSphere 5.x, since the upgrade to VSphere 6.0 the 
> assert fails:
>
> TASK [debug] 
> ******************************************************************* 
> ok: [localhost] => { 
>    "msg": "template state is POWERED ON." 
>                                                                               
>                                                
>  
> } 
>                                                                               
>                                                                               
>           
>  
>
> TASK [ensure the template is powered off] 
> ************************************** 
> fatal: [localhost]: FAILED! => { 
>    "assertion": "hw_power_status == \"POWERED OFF\"", 
>                                                                               
>                                    
>  
>    "changed": false, 
>                                                                               
>                                                                     
>  
>    "evaluated_to": false, 
>                                                                               
>                                                                
>  
>    "failed": true 
>                                                                               
>                                                                        
>  
> } 
>                                                                               
>                                                                               
>           
>  
>
> VSphere shuts down the VM as requested, so maybe it is just a timing 
> problem? 
>
> So how can I ensure the VM is really powered off before the next task 
> starts? Is there a way to wait till hw_power_status changes? 
>
> Mathias
>
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0454aba3-4d35-48d3-a705-fa8f6344ed10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to