I want use AWX to shut down the VM in hyper-V.
powershell query:
$a = Get-ClusterGroup | Where-Object {$.Name -like “server1” -and $.State -eq ‘Online’}
$b = $a.OwnerNode
Stop-VM -Name “vm1” -ComputerName $b
may I know the playbook query is that?
**- name: Hyper-V shutdown VM****hosts: all****gather_facts: no****tasks:****- win_shell: |****$a = Get-ClusterGroup | Where-Object {$_.Name -like "{{ vm }}" -and $_.State -eq 'Online'}****$b = $a.OwnerNode****Stop-VM -Name "{{ vm }}" -ComputerName $b**
In job template extra variable:
