ansible / ansible.builtin / v2.6.17 / module / vmware_vm_shell Run commands in a VMware guest operating system | "added in version" 2.1 of ansible.builtin" Authors: Ritesh Khadgaray (@ritzk), Abhijeet Kasurde (@Akasurde) preview | supported by communityansible.builtin.vmware_vm_shell (v2.6.17) — module
pip
Install with pip install ansible==2.6.17
Module allows user to run common system administration commands in the guest operating system.
- name: Run command inside a vm vmware_vm_shell: hostname: myVSphere username: myUsername password: mySecret datacenter: myDatacenter folder: /vm 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" delegate_to: localhost register: shell_command_output
port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PORT) will be used instead. - Environment variable support added in Ansible 2.6. type: int vm_id: description: - Name of the virtual machine to work with. required: true folder: default: /vm description: - Destination folder, absolute or relative path to find an existing guest or create the new guest. - The folder should include the datacenter. ESX's datacenter is ha-datacenter - 'Examples:' - ' folder: /ha-datacenter/vm' - ' folder: ha-datacenter/vm' - ' folder: /datacenter1/vm' - ' folder: datacenter1/vm' - ' folder: /datacenter1/vm/folder1' - ' folder: datacenter1/vm/folder1' - ' folder: /folder1/datacenter1/vm' - ' folder: folder1/datacenter1/vm' - ' folder: /folder1/datacenter1/vm/folder2' - ' folder: vm/folder2' - ' folder: folder2' version_added: '2.4' version_added_collection: ansible.builtin cluster: description: - The cluster hosting the virtual machine. - If set, it will help to speed up virtual machine search. hostname: description: - The hostname or IP address of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_HOST) will be used instead. - Environment variable support added in Ansible 2.6. type: str password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_PASSWORD) will be used instead. - Environment variable support added in Ansible 2.6. type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable C(VMWARE_USER) will be used instead. - Environment variable support added in Ansible 2.6. type: str vm_shell: description: - The absolute path to the program to start. - On Linux, shell is executed via bash. required: true datacenter: description: - The datacenter hosting the virtual machine. - If set, it will help to speed up virtual machine search. proxy_host: description: - Address of a proxy that will receive all HTTPS requests and relay them. - The format is a hostname or a IP. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_HOST) will be used instead. - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 required: false type: str proxy_port: description: - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - If the value is not specified in the task, the value of environment variable C(VMWARE_PROXY_PORT) will be used instead. required: false type: int vm_id_type: choices: - uuid - dns_name - inventory_path - vm_name default: vm_name description: - The VMware identification method by which the virtual machine will be identified. vm_password: description: - The password used to login-in to the virtual machine. required: true vm_username: description: - The user to login-in to the virtual machine. required: true vm_shell_cwd: description: - The current working directory of the application from which it will be run. vm_shell_env: description: - Comma separated list of environment variable, specified in the guest OS notation. vm_shell_args: default: ' ' description: - The argument to the program. validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to C(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead. - Environment variable support added in Ansible 2.6. - If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine. type: bool