I am going to say again that it is well worth taking a look at the vmware_guest module (and associated VMware modules). You just delegate the VMware modules to your vcenter and declare what you want in your playbooks and roles, meaning no need to switch into powercli syntax when you need something doing in vsphere.
Hope this helps,
Jon
Not sure if you already had an answer for this. Just came across with this requirement and found a solution.
you might want to install PowerShell on your Ansible master server #sudo install powershell, Depending on your Linux distro and version you may have to set an updated MS repo.#sudo pwshPS /home/user/> Install-Module vmware.powercliPS /home/user/> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope AllUsersCreate a PowerShell Script:Connect-VIServers Get-Host >> test.ps1Call the above ps script using ansible "command" option:---- hosts: localhosttasks:- name: Get esxi hostscommand: pwsh test.ps1Regards,Kadirvel A
--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9f8f664a-f85d-4877-9d91-24c3884a8b14%40googlegroups.com.