using cs_instance

62 views
Skip to first unread message

Daan Hoogland

unread,
Feb 26, 2016, 9:52:50 AM2/26/16
to Ansible Project
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?

René Moser

unread,
Feb 27, 2016, 4:06:00 AM2/27/16
to Ansible Project
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é

Daan Hoogland

unread,
Mar 1, 2016, 5:27:13 AM3/1/16
to Ansible Project
Op zaterdag 27 februari 2016 10:06:00 UTC+1 schreef René Moser:

BTW: Did you see the detailed guide for the cloudstack modules? http://docs.ansible.com/ansible/guide_cloudstack.html
thanks Rene, I didn't I will go through it ;)

 


René

Reply all
Reply to author
Forward
0 new messages