community / community.vmware / 4.2.0 / module / vmware_host_scanhba Rescan host HBA's and optionally refresh the storage system Authors: Michael Eaton (@michaeldeaton)community.vmware.vmware_host_scanhba (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
This module can force a rescan of the hosts HBA subsystem which is needed when wanting to mount a new datastore.
You could use this before using M(community.vmware.vmware_host_datastore) to mount a new datastore to ensure your device/volume is ready.
You can also optionally force a Refresh of the Storage System in vCenter/ESXi Web Client.
All parameters and VMware object names are case sensitive.
You can supply an esxi_hostname or a cluster_name
- name: Rescan HBA's for a given ESXi host and refresh storage system objects community.vmware.vmware_host_scanhba: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' esxi_hostname: '{{ inventory_hostname }}' refresh_storage: true delegate_to: localhost
- name: Rescan HBA's for a given cluster - all found hosts will be scanned community.vmware.vmware_host_scanhba: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' esxi_hostname: '{{ inventory_hostname }}' refresh_storage: true delegate_to: localhost
- name: Rescan for new VMFS Volumes in a given cluster, but do not scan for new Devices - all found hosts will be scanned community.vmware.vmware_host_scanhba: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' esxi_hostname: '{{ inventory_hostname }}' rescan_vmfs: true rescan_hba: false delegate_to: localhost
- name: Rescan HBA's for a given ESXi host and don't refresh storage system objects community.vmware.vmware_host_scanhba: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' esxi_hostname: '{{ inventory_hostname }}' delegate_to: localhost
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 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 rescan_hba: default: true description: - Rescan all host bus adapters for new storage devices. Rescanning all adapters can be slow. required: false type: bool rescan_vmfs: default: false description: - Rescan all known storage devices for new VMFS volumes. required: false type: bool cluster_name: description: - Cluster name to Rescan the storage subsystem on (this will run the rescan task on each host in the cluster). required: false type: str esxi_hostname: description: - ESXi hostname to Rescan the storage subsystem on. required: false 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 refresh_storage: default: false description: - Refresh the storage system in vCenter/ESXi Web Client for each host found required: false type: bool
result: description: return confirmation of requested host and updated / refreshed storage system returned: always sample: esxi01.example.com: refreshed_storage: 'true' rescaned_hba: 'true' rescaned_vmfs: 'true' type: dict