devices – Devices management.
Synopsis
Configures, modifies and unconfigures devices of a logical partition (LPAR).
This module allows to configure a specified device or all devices in defined state. It can change attributes of a device in ‘Defined/Available’ state. At last it can unconfigure or stop a device in ‘Available’ state.
Requirements
The below requirements are needed on the host that executes this module.
AIX
Python >= 3.6
Privileged user with authorizations: aix.device.manage.change,aix.device.manage.remove,aix.device.config
Parameters
- attributes (optional, dict, None)
When state=available, specifies the device attribute-value pairs used for changing specific attribute values.
When device=default, specifies the default attribute values to set for device class/subclass/type.
- device (optional, str, all)
Specifies the device logical name in the Customized Devices object class.
allspecifies to configure all devices when state=available.
defaultswitches to device defaults mode, requiring device_class, subclass, device_type, and state=available.- device_class (optional, str, None)
Specifies the device class for setting device defaults.
Required when device=default.
- subclass (optional, str, None)
Specifies the device subclass for setting device defaults.
Required when device=default.
- device_type (optional, str, None)
Specifies the device type for setting device defaults.
Required when device=default.
- force (optional, bool, False)
Forces the change/unconfigure operation to take place on a locked device.
- recursive (optional, bool, False)
Specifies to unconfigure the device and its children recursively.
- state (optional, str, available)
Specifies the desired state of the device.
available(aliaspresent) configures device when its state is ‘defined’, otherwise it changes the device attributes.
definedunconfigures/stops the device when its state is ‘available’, otherwise it changes the device attributes.
removed(aliasabsent) removes the device definition of unconfigured device in Customized Devices object class- chtype (optional, str, both)
Specifies the change type that is when the change should take place.
rebootchanges the device at system reboot.
currentchanges the current state of the device temporarily. Not persistent after a reboot. The device will not be reset. (Not all devices supports this feature)
bothchanges both the current state of the device and the device database. Persistent after a reboot. The device will not be reset. (Not all devices support this feature)
resetchanges both the current state of the device and the device database. Persistent after a reboot. The device will be reset.- parent_device (optional, str, None)
While modifying device, specifies the parent device of the device to be updated. For unconfigure/stop operation, specifies the parent device whose children need to be unconfigured recursively.
- rmtype (optional, str, unconfigure)
Specifies whether to unconfigure/stop the device.
unconfigurechanges are applied to the device when the system is rebooted.
stopchanges the current state of the device temporarily.
Notes
Note
When using device=default to set device defaults, only state=available or state=present are supported. Device defaults are applied when devices are configured or after system reboot.
You can refer to the IBM documentation for additional information on the commands used at https://www.ibm.com/support/knowledgecenter/ssw_aix_72/c_commands/cfgmgr.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/c_commands/chdev.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/r_commands/rmdev.html,
Examples
- name: Configure a device
devices:
device: proc0
state: available
- name: Unconfigure a device
devices:
device: proc0
state: defined
- name: Remove (delete) fcs0 device and children
devices:
device: fcs0
state: removed
recursive: 'true'
- name: Put fcs0 device and children in defined state
devices:
device: fcs0
state: defined
recursive: 'true'
- name: Put the children of device fcs0 in defined state
devices:
parent_device: fcs0
state: defined
- name: Remove (delete) ent0 device
devices:
device: ent0
state: absent
recursive: 'true'
- name: Change en0 MTU speed and disable arp
devices:
device: en0
state: available
attributes:
mtu: 900
arp: 'off'
- name: Configure the IP address, netmask and bring en0 up
devices:
device: en0
state: available
attributes:
netaddr: 192.168.0.1
netmask: 255.255.255.0
state: 'up'
- name: Modify Crypt0 device max_requests (Crypt0 does not support changes while available)
devices:
device: Crypt0
attributes:
max_requests:32
chtype: 'reset'
- name: Discover new devices (configure all devices)
devices:
device: "all"
state: available
- name: Set default queue_depth for virtual SCSI disks
devices:
device: default
device_class: disk
subclass: vscsi
device_type: vdisk
attributes:
queue_depth: 64
state: available
- name: Set default algorithm for FCP mpioosdisk devices
devices:
device: default
device_class: disk
subclass: fcp
device_type: mpioosdisk
attributes:
algorithm: shortest_queue
queue_depth: 32
state: available
Return Values
- msg (always, str, )
The execution message.
- rc (If the command failed., int, )
The return code.
- stdout (If the command failed., str, )
The standard output.
- stderr (If the command failed., str, )
The standard error.
Status
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by community.