powervm_virtual_switches – Create and manage PowerVM Virtual Switches
Synopsis
Creates a virtual switch with specified configuration on the managed system.
Retrieves information about virtual switches on the managed system.
Modifies an existing virtual switch (name and/or mode).
Deletes an existing virtual switch.
Requirements
The below requirements are needed on the host that executes this module.
Python >= 3.9
Parameters
- hmc_host (True, str, None)
The IP address or hostname of the HMC.
- hmc_auth (True, dict, None)
Username and password credential of the HMC.
- username (True, str, None)
Username of the HMC to log in.
- password (optional, str, None)
Password of the HMC.
- system_name (True, str, None)
The name or MTMS (machine type model serial) of the managed system.
- virtual_switch_name (optional, str, None)
The name of the virtual switch.
Required when state=present, state=modify, or state=absent.
Optional when state=facts. If provided, returns details for the specific switch. If not provided, returns all switches.
- virtual_switch_mode (optional, str, None)
The mode of the virtual switch.
Optional when state=present. Defaults to ‘Veb’ if not specified.
Optional when state=modify. If not provided, the current mode is retained.
- new_switch_name (optional, str, None)
The new name for the virtual switch when modifying.
Optional when state=modify. If not provided, the current name is retained.
For state=modify, at least one of virtual_switch_mode or new_switch_name must be provided.
- state (optional, str, facts)
presentcreates a new virtual switch.
modifymodifies an existing virtual switch (name and/or mode).
absentdeletes an existing virtual switch.
factsretrieves information about virtual switches. If virtual_switch_name is provided, returns details for that specific switch only.
Notes
Note
This module supports creating virtual switches and retrieving virtual switch information.
Examples
- name: Create a virtual switch
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
virtual_switch_name: ETHERNET1
virtual_switch_mode: Veb
state: present
- name: Modify a virtual switch (change mode)
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
virtual_switch_name: ETHERNET1
virtual_switch_mode: Vepa
state: modify
- name: Modify a virtual switch (change name and mode)
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
virtual_switch_name: ETHERNET1
new_switch_name: ETHERNET2
virtual_switch_mode: Veb
state: modify
- name: Delete a virtual switch
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
virtual_switch_name: ETHERNET1
state: absent
- name: Get all virtual switch facts
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
state: facts
- name: Get specific virtual switch facts
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
virtual_switch_name: ETHERNET1
state: facts
- name: Get virtual switch facts using MTMS
ibm.power_hmc.powervm_virtual_switches:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <machine_type_model_serial>
state: facts
Return Values
- virtual_switch_info (on success, dict, )
Information about virtual switches on the managed system.
- virtual_switches (, list, )
List of virtual switches on the managed system.
- switch_name (, str, )
Name of the virtual switch.
- switch_mode (, str, )
Mode of the virtual switch (
VeborVepa).- switch_id (, str, )
Unique numeric identifier of the virtual switch.
Status
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by community.