Hi Sebastien,

Thanks very much for the comprehensive reply. Would you be able to share
any of those scripts / playbooks you mentioned. I’ve no familiarity with
powercli and have yet to dabble with VMware modules in ansible.

Anything would be greatly appreciated just to get me started.

Thanks again,

Ted

On Fri 27 Apr 2018 at 17:33, Sebastien Desbois <sebastien.desb...@gmail.com>
wrote:

> Hello,
>
> You can't do that with only ansible modules
> Here is the solution we have found to do this :
> - Convert template to VM : use ansible to execute a powercli script to do
> that. (even more easy now with Linux powercli)
> - Power on the VM with module vsphere_guest (yes, old module but working
> really fine)
> - Get VMfacts with module vsphere_guest (need that to get the IP of the VM
> - assumption : that the VM has a network cardwith either a fixed IP or in
> DHCP)
> - Put VM info in in-memory inventory (espcially the IP)
> - Log to the VM and update it through standard ansible modules (you can do
> either linux or windows VMs like that)
> - Shut down the VM with a powercli script with a Stop-VMGuest cmdlet (and
> in this script loop until you get the VM state as powered off) -- use of
> vpshere_guest is not recommanded to stop the VM because it's not doing a
> proper shutdown at OS level
> - Convert back the VM to template with a powercli script
>
> It may be a little complexe but it's working fine.
> Maybe some of this can be done with vmware_guest and vmware_guest_facts,
> but I don't like the current version of those modules. I had too many bugs
> with them.
>
>
> Best Regards,
>
> Sebastien
>
>
> Le vendredi 27 avril 2018 15:55:55 UTC+2, Ted a écrit :
>>
>> Hi All,
>>
>> I'm looking for a way to convert a VMware template to a virtual machine
>> using Ansible.
>> The work flow is:
>> Convert a template to a virtual machine
>> Power on
>> Login to the virtual machine
>> Update the OS patches (Linux)
>> Power off
>> Convert Virtual machine back to template
>>
>> As you can see I want to keep the patch levels up to date on my templates
>> and do all the above in Ansible.
>> I've searched for ways to do this but haven't come up with anything.
>>
>> Any suggestions are most welcome.
>>
>> Thanks,
>>
>> Ted
>>
>> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0287c9ca-62e7-4619-80f2-0bb9c47be48f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/0287c9ca-62e7-4619-80f2-0bb9c47be48f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2Boyv2fOZEzbtcSMMg%2BYPyxRW2d%3DN%3D-Ft8p41tdmvWk_PEXNYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to