Hey Kyle – I have done a bit of ansible playbooks for the VI environment I work in…I had found that ansible is someone limit with the VI module. I have accomplished everything with PowerCLI with ansible.windows.win_shell module. I run it all from the Ansible server by installing Powershell on the RHEL ansible server. This setup allows us to run deeper/more complicated plays.
My 2 cents…
--
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/ed094263-70fd-49c7-b140-7dfc408f3239n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/WeN4U0Rcgic/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/214101d95533%2467e00d10%2437a02730%24%40gmail.com.
Just a example but there is a lot out there: https://petri.com/use-powercli-create-snapshot/
Examples of the plays that I run:
- name: Check the servers in the cluster to ensure none are offline
ansible.builtin.shell: |
Connect-VIServer -Server "{{ inventory_hostname }}" -User "{{ Admin_Acct }}" -Password "{{ Admin_Pass }}" | Out-Null
$NotRespondingHost = (Get-Cluster | Get-VMHost | ? { $_.ConnectionState -match "NotResponding"}).Name
ForEach ($NotRespondingHost in $NotRespondingHosts) {
$pos = $NotRespondingHost.IndexOf(".")
$ESXi_name = $NotRespondingHost.Substring(0, $pos)
$domain_name = $NotRespondingHost.Substring($pos+1)
$ESXi_name + "._ilo." + $domain_name
}
args:
executable: /usr/bin/pwsh
register: NotRespondingHostILO_Pre
delegate_to: localhost
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAP2pnAegRe_HhsipuuK1Twjqn1enfNhNLNdM3ZML%3DmnLv8krcw%40mail.gmail.com.