tsailiming/ansible-hyperv

cant see function poweroff

Closed this issue · 1 comments

On trying to use poweroff getting below error.

Below playbook which i have used for reference


  • name: Delete VM
    hosts: b07.lab.ltsai.com
    gather_facts: no

    tasks:

    • name: Include vm env var
      include_vars:
      file: "{{env}}.yml"

    • name: Poweroff VMs
      win_hyperv_guest:
      name: "{{item.name}}"
      state: poweroff
      with_items: "{{ vms }}"

    • name: Delete VMs
      win_hyperv_guest:
      name: "{{item.name}}"
      state: absent
      with_items: "{{ vms }}"

    • name: Remove vhd
      win_file:
      path: "{{item.dest_vhd}}"
      state: absent
      with_items: "{{ vms }}"

FAILED! => {"changed": false, "msg": "The state: save doesn't exist; State can only be: present, absent, started or stopped"}

I found the reason for the issue. In readme file, link given to powershell script https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 does not have the turnoff function. Please update the document to include it.