W3cubDocs

/Ansible

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

Requirements (on host that executes module)

  • python >= 2.6
  • PyVmomi

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 seperated 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

Note

Only the first match against vm_id is used, even if there are multiple matches

This is an Extras Module

For more information on what this means please read Extras Modules

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

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/vmware_vm_shell_module.html