community / community.vmware / 1.18.2 / module / vmware_host_iscsi Manage the iSCSI configuration of ESXi host Authors: sky-joker (@sky-joker)community.vmware.vmware_host_iscsi (1.18.2) — module
Install with ansible-galaxy collection install community.vmware:==1.18.2
collections: - name: community.vmware version: 1.18.2
In this module, can manage the iSCSI configuration of ESXi host
- name: Enable iSCSI of ESXi community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" state: enabled
- name: Add a dynamic target to iSCSI config of ESXi community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" iscsi_config: vmhba_name: vmhba65 send_target: address: "{{ send_target_address }}" state: present
- name: Add a static target to iSCSI config of ESXi community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" iscsi_config: vmhba_name: vmhba65 static_target: iscsi_name: iqn.2011-08.com.xxxxxxx:as6104t-8c3e9d.target001 address: "{{ send_target_address }}" state: present
- name: Add VMKernels to iSCSI config of ESXi community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" iscsi_config: vmhba_name: vmhba65 port_bind: - vmk0 - vmk1 state: present
- name: Use CHAP authentication community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" iscsi_config: vmhba_name: vmhba65 authentication: chap_auth_enabled: true chap_authentication_type: chapPreferred chap_name: chap_user_name chap_secret: secret state: present
- name: Remove a dynamic target from iSCSI config of ESXi community.vmware.vmware_host_iscsi: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" esxi_hostname: "{{ esxi_hostname }}" iscsi_config: vmhba_name: vmhba65 send_target: address: "{{ send_target_address }}" state: absent
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 state: choices: - present - absent - enabled - disabled default: present description: - If set to C(present), add the iSCSI target or the bind ports if they are not existing. - If set to C(present), update the iSCSI settings if they already exist and occur change. - If set to C(absent), remove the iSCSI target or the bind ports if they are existing. - If set to (enabled), enable the iSCSI of ESXi if the iSCSI is disabled. - If set to (disabled), disable the iSCSI of ESXi if the iSCSI is enabled. type: str 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 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 iscsi_config: description: - The iSCSI configs. - This parameter is required if I(state=present) or I(state=absent). suboptions: alias: default: '' description: - The new value for the alias of the adapter. type: str authentication: description: - CHAP authentication parent settings for iSCSI. suboptions: chap_auth_enabled: default: false description: - Whether to enable CHAP authentication. type: bool chap_authentication_type: choices: - chapDiscouraged - chapPreferred - chapRequired - chapProhibited default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of CHAP if CHAP is enabled. type: str chap_name: default: '' description: - CHAP user name if CHAP is enabled. type: str chap_secret: description: - The secret password of CHAP if CHAP is enabled. type: str mutual_chap_authentication_type: choices: - chapProhibited - chapRequired default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of Mutual-CHAP if CHAP is enabled. type: str mutual_chap_name: default: '' description: - The user name that the target needs to use to authenticate with the initiator if Mutual-CHAP is enabled. type: str mutual_chap_secret: description: - The secret password of mutual CHAP if Mutual-CHAP is enabled. type: str type: dict force: default: false description: - Force port bind VMkernels to be removed. type: bool iscsi_name: aliases: - initiator_iqn description: - The name for the iSCSI HBA adapter. - This is iSCSI qualified name. type: str version_added: 1.7.0 version_added_collection: community.vmware port_bind: default: [] description: - The list of the VMkernels if use port bindings. elements: str type: list send_target: description: - The iSCSI dynamic target settings. suboptions: address: description: - The IP address or hostname of the storage device. required: true type: str authentication: description: - CHAP authentication settings of a dynamic target for iSCSI. suboptions: chap_auth_enabled: default: false description: - Whether to enable CHAP authentication. type: bool chap_authentication_type: choices: - chapDiscouraged - chapPreferred - chapRequired - chapProhibited default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of CHAP if CHAP is enabled. type: str chap_inherited: default: true description: - Whether or not to inherit CHAP settings from the parent settings. type: bool chap_name: default: '' description: - CHAP user name if CHAP is enabled. type: str chap_secret: description: - The secret password of CHAP if CHAP is enabled. type: str mutual_chap_authentication_type: choices: - chapProhibited - chapRequired default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of Mutual-CHAP if CHAP is enabled. type: str mutual_chap_inherited: default: true description: - Whether or not to inherit Mutual-CHAP settings from the parent settings. type: bool mutual_chap_name: default: '' description: - The user name that the target needs to use to authenticate with the initiator if Mutual-CHAP is enabled. type: str mutual_chap_secret: description: - The secret password of mutual CHAP if Mutual-CHAP is enabled. type: str type: dict port: default: 3260 description: - The TCP port of the storage device. - If not specified, the standard default of 3260 is used. type: int type: dict static_target: description: - The iSCSI static target settings. suboptions: address: description: - The IP address or hostname of the storage device. required: true type: str authentication: description: - CHAP authentication settings of a static target for iSCSI. suboptions: chap_auth_enabled: default: false description: - Whether to enable CHAP authentication. type: bool chap_authentication_type: choices: - chapDiscouraged - chapPreferred - chapRequired - chapProhibited default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of CHAP if CHAP is enabled. type: str chap_inherited: default: true description: - Whether or not to inherit CHAP settings from the parent settings. type: bool chap_name: default: '' description: - CHAP user name if CHAP is enabled. type: str chap_secret: description: - The secret password of CHAP if CHAP is enabled. type: str mutual_chap_authentication_type: choices: - chapProhibited - chapRequired default: chapProhibited description: - The preference for CHAP or non-CHAP protocol of Mutual-CHAP if CHAP is enabled. type: str mutual_chap_inherited: default: true description: - Whether or not to inherit Mutual-CHAP settings from the parent settings. type: bool mutual_chap_name: default: '' description: - The user name that the target needs to use to authenticate with the initiator if Mutual-CHAP is enabled. type: str mutual_chap_secret: description: - The secret password of mutual CHAP if Mutual-CHAP is enabled. type: str type: dict iscsi_name: description: - The name of the iSCSI target to connect to. required: true type: str port: default: 3260 description: - The TCP port of the storage device. - If not specified, the standard default of 3260 is used. type: int type: dict vmhba_name: description: - The iSCSI adapter name. required: true type: str type: dict esxi_hostname: description: - The ESXi hostname on which to change iSCSI settings. required: true type: str 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
iscsi_properties: description: Parameter return when system defaults config is changed. returned: changed sample: "{\n \"iscsi_alias\": \"\",\n \"iscsi_authentication_properties\"\ : {\n \"_vimtype\": \"vim.host.InternetScsiHba.AuthenticationProperties\"\ ,\n \"chapAuthEnabled\": false,\n \"chapAuthenticationType\": \"\ chapProhibited\",\n \"chapInherited\": null,\n \"chapName\": \"\"\ ,\n \"chapSecret\": \"XXXXXXXXXXXXXXXXXXXXX\",\n \"mutualChapAuthenticationType\"\ : \"chapProhibited\",\n \"mutualChapInherited\": null,\n \"mutualChapName\"\ : \"XXXXXXXXXXXXXXXXXXXXX\",\n \"mutualChapSecret\": \"\"\n },\n \ \ \"iscsi_enabled\": true,\n \"iscsi_name\": \"\",\n \"iscsi_send_targets\"\ : [],\n \"iscsi_static_targets\": [],\n \"port_bind\": [],\n \"vmhba_name\"\ : \"vmhba65\"\n}" type: dict