using cs_instance

LS, I am trying to use the cloudstack set of modules with ansible 2.0

host file:

[vms]
vm01

end of host file

stip.yaml:

  • hosts: all
    gather_facts: no
    tasks:
  • name: stop vm
    local_action: cs_instance name=“{{ inventory_hostname }}” state=stopped

end of stop.yaml

command:
$ ansible-playbook stop.yaml -i …/inventory/vms/hosts

PLAY ***************************************************************************

TASK [stop vm] *****************************************************************
fatal: [bubble05 → localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Template or ISO is required.”}

PLAY RECAP *********************************************************************
bubble05 : ok=0 changed=0 unreachable=0 failed=1

✘-2 ~/leaseweb/provisioning/ansible/bubbles [mkbubble L|…13]
12:22 $ ansible-playbook stop.yaml -i …/inventory/vms/hosts

PLAY ***************************************************************************

TASK [stop vm] *****************************************************************
fatal: [vm01 → localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Template or ISO is required.”}

PLAY RECAP *********************************************************************
vm01 : ok=0 changed=0 unreachable=0 failed=1

In my interpretation of the module docs at http://docs.ansible.com/ansible/cs_instance_module.html the state=stopped would not require me to add a template or iso parameter, or does it? Or maybe I am missing something else?

Hi Daan

It is true that state=stopped does not require template/iso if the VM is
present. If the VM is not yet present, it will try to create a VM which
will not boot (state=stopped), which will require a template or iso.

Is the VM present?

BTW: Did you see the detailed guide for the cloudstack modules? http://docs.ansible.com/ansible/guide_cloudstack.html

René


BTW: Did you see the detailed guide for the cloudstack modules? [http://docs.ansible.com/ansible/guide_cloudstack.html](http://docs.ansible.com/ansible/guide_cloudstack.html)

thanks Rene, I didn’t I will go through it :wink: