zhmc_nic - Manages NICs in existing partitions¶
Synopsis¶
- Creates, updates, and deletes NICs in existing partitions of a CPC.
- The targeted CPC must be in the Dynamic Partition Manager (DPM) operational mode.
Requirements (on host that executes module)¶
- Network access to HMC
- zhmcclient >=0.14.0
- ansible >=2.2.0.0
Options¶
parameter | required | default | choices | comments | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cpc_name |
yes |
The name of the CPC with the partition containing the NIC.
|
|||||||||||||||||
faked_session |
no | Real HMC will be used. |
A
zhmcclient_mock.FakedSession object that has a mocked HMC set up. If provided, it will be used instead of connecting to a real HMC. This is used for testing purposes only. |
||||||||||||||||
hmc_auth |
yes |
The authentication credentials for the HMC.
| |||||||||||||||||
|
|||||||||||||||||||
hmc_host |
yes |
The hostname or IP address of the HMC.
|
|||||||||||||||||
log_file |
no |
File path of a log file to which the logic flow of this module as well as interactions with the HMC are logged. If null, logging will be propagated to the Python root logger.
|
|||||||||||||||||
name |
yes |
The name of the target NIC that is managed. If the NIC needs to be created, this value becomes its name.
|
|||||||||||||||||
partition_name |
yes |
The name of the partition containing the NIC.
|
|||||||||||||||||
properties |
no | No input properties |
Dictionary with input properties for the NIC, for
state=present . Key is the property name with underscores instead of hyphens, and value is the property value in YAML syntax. Integer properties may also be provided as decimal strings. Will be ignored for state=absent .The possible input properties in this dictionary are the properties defined as writeable in the data model for NIC resources (where the property names contain underscores instead of hyphens), with the following exceptions:
*
name : Cannot be specified because the name has already been specified in the name module parameter.*
network_adapter_port_uri and virtual_switch_uri : Cannot be specified because this information is specified using the artificial properties adapter_name and adapter_port .*
adapter_name : The name of the adapter that has the port backing the target NIC. Used for all adapter families (ROCE, OSA, Hipersockets).*
adapter_port : The port index of the adapter port backing the target NIC. Used for all adapter families (ROCE, OSA, Hipersockets).Properties omitted in this dictionary will remain unchanged when the NIC already exists, and will get the default value defined in the data model for NICs when the NIC is being created.
|
||||||||||||||||
state |
yes |
|
The desired state for the target NIC:
absent : Ensures that the NIC does not exist in the specified partition.present : Ensures that the NIC exists in the specified partition and has the specified properties. |
Examples¶
--- # Note: The following examples assume that some variables named 'my_*' are set. - name: Ensure NIC exists in the partition zhmc_partition: hmc_host: "{{ my_hmc_host }}" hmc_auth: "{{ my_hmc_auth }}" cpc_name: "{{ my_cpc_name }}" partition_name: "{{ my_partition_name }}" name: "{{ my_nic_name }}" state: present properties: adapter_name: "OSD 0128 A13B-13" adapter_port: 0 description: "The port to our data network" device_number: "023F" register: nic1 - name: Ensure NIC does not exist in the partition zhmc_partition: hmc_host: "{{ my_hmc_host }}" hmc_auth: "{{ my_hmc_auth }}" cpc_name: "{{ my_cpc_name }}" partition_name: "{{ my_partition_name }}" name: "{{ my_nic_name }}" state: absent
Return Values¶
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
nic |
For
state=absent , an empty dictionary.For
state=present , a dictionary with the resource properties of the NIC (after changes, if any). The dictionary keys are the exact property names as described in the data model for the resource, i.e. they contain hyphens (-), not underscores (_). The dictionary values are the property values using the Python representations described in the documentation of the zhmcclient Python package. |
success | dict | {
"name": "nic-1",
"description": "NIC #1",
"virtual-switch-uri': "/api/vswitches/...",
...
}
|
Notes¶
Note
- See also Ansible module zhmc_partition.
Status¶
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Support¶
This module is community maintained without core committer oversight.
For more information on what this means please read Module Support.
For help in developing on modules, should you be so inclined, please read the contribution guidelines in the module’s source repository, Testing Ansible and Developing Modules.
Shipment¶
This module is a third-party module and is not shipped with Ansible. See the module’s source repository for details.