Documentation

vmware_vm_shell - Execute a process in VM

New in version 2.1.

Synopsis

  • Start a program in a VM without the need for network connection

Options

parameter required default choices comments
cluster
no None
The cluster hosting the VM
Will help speed up search
datacenter
no None
The datacenter hosting the VM
Will help speed up search
hostname
yes
The hostname or IP address of the vSphere vCenter.
password
yes
The password of the vSphere vCenter.

aliases: pass, pwd
username
yes
The username of the vSphere vCenter.

aliases: user, admin
validate_certs
no True
  • True
  • False
Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.
vm_id
yes
The identification for the VM
vm_id_type
no vm_name
  • uuid
  • dns_name
  • inventory_path
  • vm_name
The identification tag for the VM
vm_password
no None
The password used to login to the VM.
vm_shell
yes
The absolute path to the program to start. On Linux this is executed via bash.
vm_shell_args
no None
The argument to the program.
vm_shell_cwd
no None
The current working directory of the application from which it will be run
vm_shell_env
no None
Comma separated list of envirnoment variable, specified in the guest OS notation
vm_username
no None
The user to connect to the VM.

Examples

- name: shell execution
  local_action:
    module: vmware_vm_shell
    hostname: myVSphere
    username: myUsername
    password: mySecret
    datacenter: myDatacenter
    vm_id: NameOfVM
    vm_username: root
    vm_password: superSecret
    vm_shell: /bin/echo
    vm_shell_args: " $var >> myFile "
    vm_shell_env:
      - "PATH=/bin"
      - "VAR=test"
    vm_shell_cwd: "/tmp"

Notes

Note

  • Tested on vSphere 5.5
  • Only the first match against vm_id is used, even if there are multiple matches

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.