Encendre màquines virtuals a VMWare ESXi
Traducció de l’original en anglès. Llegeix-lo en: CastellanoEnglish
Les ordres següents són molt útils quan no tens accés a la UI de vSphere i has d'accedir a l'hipervisor VMWare per SSH o consola:
# get the list of virtual machines
vim-cmd vmsvc/getallvms
# get the state of a VM with #id: VM_ID
vim-cmd vmsvc/power.getstate VM_ID
# turn on the virtual machine with #id: VM_ID
vim-cmd vmsvc/power.on VM_ID
Una altra opció per encendre la màquina virtual és fer servir un playbook d'Ansible:
- hosts: vmware
gather_facts: false
tasks:
- vsphere_guest:
vcenter_hostname: "X.X.X.X"
username: "{{ hostvars[inventory_hostname].ansible_ssh_user|quote }}"
password: "{{ hostvars[inventory_hostname].ansible_ssh_pass|quote }}"
guest: "NAME_OF_THE_VM"
state: "powered_on"
delegate_to: localhost