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

Requirements (on host that executes module)

  • python >= 2.6
  • PyVmomi

Options

parameter required default choices comments
datacenter
no
    The datacenter hosting the VM
    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
          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
              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
                        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: DNSnameOfVM
                            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, Helping Testing PRs and Developing Modules.