community.vmware.vmware_host_passthrough (4.2.0) — module

Manage PCI device passthrough settings on host

Authors: sky-joker (@sky-joker)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

This module can be managed PCI device passthrough settings on host.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable PCI device passthrough against the whole ESXi in a cluster
  community.vmware.vmware_host_passthrough:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    validate_certs: false
    cluster: "{{ ccr1 }}"
    devices:
      - device_name: "Dual Band Wireless AC 3165"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable PCI device passthrough against one ESXi
  community.vmware.vmware_host_passthrough:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    validate_certs: false
    esxi_hostname: "{{ esxi1 }}"
    devices:
      - device_name: "Dual Band Wireless AC 3165"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable PCI device passthrough with PCI ids
  community.vmware.vmware_host_passthrough:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    validate_certs: false
    esxi_hostname: "{{ esxi1 }}"
    devices:
      - device: '0000:03:00.0'
      - device: '0000:00:02.0'
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Disable PCI device passthrough against the whole ESXi in a cluster
  community.vmware.vmware_host_passthrough:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    validate_certs: false
    cluster: "{{ ccr1 }}"
    devices:
      - device_name: "Dual Band Wireless AC 3165"
    state: absent

Inputs

    
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 E(VMWARE_PORT)
      will be used instead.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - If V(state=present), passthrough of PCI device will be enabled.
    - If V(state=absent), passthrough of PCI device will be disabled.
    type: str

cluster:
    aliases:
    - cluster_name
    description:
    - Name of the cluster from which all host systems will be used.
    - This parameter is required if O(esxi_hostname) is not specified.
    type: str

devices:
    description:
    - List of PCI device name or id.
    elements: dict
    required: true
    suboptions:
      device:
        aliases:
        - name
        - device_name
        description:
        - Name of PCI device to enable passthrough.
        type: str
    type: list

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 E(VMWARE_HOST)
      will be used instead.
    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 E(VMWARE_PASSWORD)
      will be used instead.
    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 E(VMWARE_USER)
      will be used instead.
    type: str

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 E(VMWARE_PROXY_HOST)
      will be used instead.
    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 E(VMWARE_PROXY_PORT)
      will be used instead.
    required: false
    type: int

esxi_hostname:
    description:
    - Name of the host system to work with.
    - This parameter is required if O(cluster_name) is not specified.
    - User can specify specific host from the cluster.
    type: str

validate_certs:
    default: true
    description:
    - Allows connection when SSL certificates are not valid. Set to V(false) when certificates
      are not trusted.
    - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS)
      will be used instead.
    type: bool

Outputs

passthrough_configs:
  description:
  - list of that PCI devices have been enabled passthrough for each host system.
  elements: dict
  returned: changed
  sample: "[\n    {\n        \"esxi-01.example.com\": [\n            {\n         \
    \       \"device_id\": \"0000:03:00.0\",\n                \"device_name\": \"\
    Dual Band Wireless AC 3165\",\n                \"passthruEnabled\": true\n   \
    \         }\n        ]\n    },\n    {\n        \"esxi-02.example.com\": [\n  \
    \          {\n                \"device_id\": \"0000:03:00.0\",\n             \
    \   \"device_name\": \"Dual Band Wireless AC 3165\",\n                \"passthruEnabled\"\
    : true\n            }\n        ]\n    }\n]"
  type: list