powervm_virtual_network – Create and manage PowerVM Virtual Networks
Synopsis
Creates a virtual network with specified configuration on the managed system.
Retrieves information about virtual networks on the managed system.
Updates the name of the virtual network on the managed system.
Deletes virtual networks from the managed system.
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.
- network_name (optional, str, None)
The name of the virtual network.
Required when state=present, state=absent, or state=updated.
Optional when state=facts. If provided, returns details for the specific network. If not provided, returns all networks.
- network_vlan_id (optional, int, None)
The VLAN ID for the virtual network.
Required when state=present.
Must be a valid VLAN ID between 1 and 4094 (inclusive).
- switch_name (optional, str, None)
The name of the virtual switch to associate with this network.
Mutually exclusive with switch_id.
Either switch_name or switch_id is required when state=present.
- switch_id (optional, int, None)
The ID of the virtual switch to associate with this network.
Mutually exclusive with switch_name.
Either switch_name or switch_id is required when state=present.
- tagged_network (optional, bool, False)
Specifies whether the network is tagged or untagged.
Optional when state=present. Defaults to
Falseif not specified.- state (True, str, None)
presentcreates a new virtual network.
absentdeletes an existing virtual network.
updatedupdates the name of an existing virtual network.
factsretrieves information about virtual networks. If network_name is provided, returns details for that specific network only.- new_network_name (optional, str, None)
The new name for the virtual network when updating.
Required when state=updated.
Notes
Note
This module supports creating virtual networks and retrieving virtual network information.
Virtual networks are associated with virtual switches on the managed system.
Examples
- name: Create a virtual network with switch name
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
network_name: vnw-lp02
network_vlan_id: 101
switch_name: ETHERNET0
tagged_network: false
state: present
- name: Create a virtual network with switch ID
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
network_name: vnw-lp03
network_vlan_id: 102
switch_id: 0
tagged_network: true
state: present
- name: Update a virtual network name
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
network_name: vnw-lp02
new_network_name: vnw-lp02-updated
state: updated
- name: Delete a virtual network
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
network_name: vnw-lp02
state: absent
- name: Get all virtual network facts
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
state: facts
- name: Get specific virtual network facts
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <managed_system_name>
network_name: vnw-lp02
state: facts
- name: Get virtual network facts using MTMS
ibm.power_hmc.powervm_virtual_network:
hmc_host: "{{ inventory_hostname }}"
hmc_auth:
username: '{{ ansible_user }}'
password: '{{ hmc_password }}'
system_name: <machine_type_model_serial>
state: facts
Return Values
- virtual_network_info (on success, dict, {‘virtual_networks’: [{‘network_name’: ‘vnw-lp02’, ‘network_vlan_id’: ‘101’, ‘switch_name’: ‘ETHERNET0’, ‘switch_id’: ‘0’, ‘tagged_network’: ‘false’}]})
Information about virtual networks on the managed system.
Status
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by community.