powervm_lpar_instance – Create, Delete, Shutdown, Activate, Restart, Facts and Install of PowerVM Partitions

Synopsis

Creates AIX/Linux or IBMi partition with specified configuration details on mentioned system

Or Deletes specified AIX/Linux or IBMi partition on specified system

Or Shutdown specified AIX/Linux or IBMi partition on specified system

Or Poweron/Activate specified AIX/Linux or IBMi partition, with provided configuration details on the mentioned system

Or Restart specified AIX/Linux or IBMi partition on specified system

Or Facts of the specified AIX/Linux or IBMi partition of specified system

Or Install of PowerVM Partition

Requirements

The below requirements are needed on the host that executes this module.

  • Python >= 3

  • lxml

Parameters

hmc_host (True, str, None)

IPaddress or hostname of the HMC.

hmc_auth (True, dict, None)

Username and Password credential of the HMC.

username (True, str, None)

HMC username.

password (optional, str, None)

HMC password.

system_name (optional, str, None)

The name of the managed system.

Optional for state=absent, state=facts, action=poweron, action=shutdown and action=restart.

vm_name (True, str, None)

The name of the powervm partition.

vm_id (optional, int, None)

The partition ID to be set while creating a Logical Partition.

Optional, if not provided, next available value will be assigned.

proc (optional, int, None)

The number of dedicated processors to create a partition.

If proc_unit parameter is set, then this value will work as virtual processors for shared processor setting.

Default value is ‘2’. This will not work during shared processor setting.

max_proc (optional, int, None)

The maximum number of dedicated processors to create a partition.

If proc_unit parameter is set, then this value will work as max virtual processors for shared processor setting.

Default value is proc.

This value should be always equal or greater than proc.

min_proc (optional, int, None)

The minimum number of dedicated processors to create a partition.

If proc_unit parameter is set, then this value will work as min virtual processors for shared processor setting.

Default value is ‘1’.

This value should be always equal or less than proc.

proc_unit (optional, float, None)

The number of shared processing units to create a partition.

shared_proc_pool (optional, str, None)

Shared Processor Pool ID or Name.

If numeric value provided to this parameter, it will be considered as Shared Processor Pool ID.

This parameter can be used only with proc_unit.

Default value is ‘DefaultPool’.

max_proc_unit (optional, float, None)

The maximum number of shared processing units to create a partition.

This value should be equal or greater than proc_unit.

This parameter can be used only with proc_unit.

Default value is proc_unit.

min_proc_unit (optional, float, None)

The minimum number of shared processing units to create a partition.

This value should be equal or less than proc_unit.

This parameter can be used only with proc_unit.

Default value is ‘0.1’.

proc_mode (optional, str, None)

The processor mode to be used to create a partition with shared processor settings.

Default value is ‘uncapped’.

This parameter can be used only with proc_unit.

weight (optional, int, None)

The weight to be used for uncapped proc mode while create a partition with shared processor settings.

Default value is ‘128’.

This value will be ignored if the proc_mode is set to capped.

This parameter can be used only with proc_mode.

proc_compatibility_mode (optional, str, None)

The processor compatibility mode to be configured while creating a partition.

mem (optional, int, None)

The value of dedicated memory value in megabytes to create a partition.

Default value is ‘2048 MB’.

max_mem (optional, int, None)

The maximum value of dedicated memory value in megabytes to create a partition.

Default value is ‘2048 MB’.

This parameter can only be used with mem.

min_mem (optional, int, None)

The maximum value of dedicated memory value in megabytes to create a partition.

Default value is ‘1024 MB’.

This parameter can only be used with mem.

os_type (optional, str, None)

Type of logical partition to be created.

aix_linux or linux or aix for AIX or Linux operating system.

ibmi for IBMi operating system.

prof_name (optional, str, None)

Partition profile to be used to activate a partition.

If the user doesn’t provide this option, the current configuration of partition will be used for activation.

This option is valid only for poweron action.

keylock (optional, str, None)

The keylock position to be set while activating a partition.

If the user doesn’t provide this option, the current setting of this option in partition will be considered.

This option is valid only for poweron action.

iIPLsource (optional, str, None)

The initial program load (IPL) source to be used while activating an IBMi partition.

If the user doesn’t provide this option, current setting of this option in the partition will be considered.

If this option provided for AIX/Linux type partition, operation gives a warning and then ignores this option and proceed with the operation.

This option is valid only for poweron action.

volume_config (optional, list, None)

Storage volume configurations of a partition.

Attach Physical Volumes via Virtual SCSI.

Redundant paths created by default, if the specified/identified physical volume is visible in more than one VIOS.

User needs to provide either volume_size or both volume_name and vios_name. If volume_size is provided, available physical volume matching or greater than specified size would be attached.

volume_name (optional, str, None)

Physical volume name visible through VIOS.

This option is mutually exclusive with volume_size.

vios_name (optional, str, None)

VIOS name to which mentioned volume_name is present.

This option is mutually exclusive with volume_size.

volume_size (optional, int, None)

Physical volume size in MB.

virt_network_config (optional, list, None)

Virtual Network configuration of the partition.

This implicitly adds a Virtual Ethernet Adapter with given virtual network to the partition.

Make sure provided Virtual Network has been attached to an active Network Bridge for external network communication.

network_name (True, str, None)

Name of the Virtual Network to be attached to the partition.

This option is mandatory.

slot_number (optional, int, None)

Virtual slot number of a partition on which virtual network to be attached.

Optional, if not provided, next available value will be assigned.

npiv_config (optional, list, None)

To configure N-Port ID Virtualization is also known as Virtual Fibre of the partition.

User can provide two fc port configurations and mappings will be created with VIOS implicitly.

vios_name (True, str, None)

The name of the vios in which fc port available.

This option is mandatory.

fc_port (True, str, None)

The port to be used for npiv. User can specify either port name or fully qualified location code.

This option is mandatory.

wwpn_pair (optional, str, None)

The WWPN pair value to be configured with client FC adapter.

Both the WWPN value should be separated by semicolon delimiter.

Optional, if not provided the value will be auto assigned.

client_adapter_id (optional, int, None)

The client adapter slot number to be configured with FC adapter.

Optional, if not provided next available value will be assigned.

server_adapter_id (optional, int, None)

The Server adapter slot number to be configured with FC adapter.

Optional, if not provided next available value will be assigned.

all_resources (optional, bool, None)

Creates a partition with all the resources available in the managed system.

When we choose this as true, make sure that all partitions are in a shutdown state, if any exist in the managed system.

Default is false

max_virtual_slots (optional, int, None)

Maximum virtual slot configuration of the partition.

If the user doesn’t provide, it creates partition with max_virtual_slots 20 as default.

physical_io (optional, list, None)

Physical IO adapter to be added to the partition.

An illustrative pattern for IO location code is XXXXX.XXX.XXXXXXX-P1-T1 or P1-T1.

retain_vios_cfg (optional, bool, None)

Do not remove the VIOS configuration like server adapters, storage mappings associated with the partition when deleting the partition.

Applicable only for absent state.

Default is to remove the associated VIOS configuration when deleting the partition.

delete_vdisks (optional, bool, None)

Option to delete the Virtual Disks associated with the partition when deleting the partition.

Default is to not delete the virtual disks.

advanced_info (optional, bool, None)

Option to display advanced information of the logical partition.

Applicable only for facts state.

Default is false.

Currently it is showing only NPIV storage details.

install_settings (optional, dict, None)

Settings for installing Operating System on logical partition.

User expected to have NIM Server with pull install configuration.

vm_ip (True, str, None)

IP Address to be configured to Logical Partition.

nim_ip (True, str, None)

IP Address of the NIM Server.

nim_gateway (True, str, None)

Logical Partition gateway IP Address.

nim_subnetmask (True, str, None)

Subnetmask IP Address to be configured to Logical Partition.

location_code (optional, str, None)

Network adapter location code to be used while installing OS.

If user doesn’t provide, it automatically picks the first pingable adapter attached to the partition.

nim_vlan_id (optional, str, None)

Specifies the VLANID(0 to 4094) to use for tagging Ethernet frames during network install for virtual network communication.

Default value is 0.

nim_vlan_priority (optional, str, None)

Specifies the VLAN priority (0 to 7) to use for tagging Ethernet frames during network install for virtual network communication.

Default value is 0.

timeout (optional, int, None)

Max waiting time in mins for OS to bootup fully.

Min timeout should be more than 10 mins.

Default value is 60 min.

vnic_config (optional, list, None)

Virtual NIC configuration of the partition.

vnic_adapter_id (optional, int, None)

VNIC Adapter ID to be configured while creating a partition.

Optional, if not provided, next available value will be assigned.

backing_devices (optional, list, None)

SRIOV physical ports to be used as a backing device of VNIC.

If user doesn’t provide this option, by default it picks the SRIOV Physical port with link status up as backing device.

If there are no SRIOV Physical port with link status as up then it randomly picks physical port which has capacity more than 2.0%.

location_code (True, str, None)

SRIOV Physical port location code to be used as backing device.

An illustrative pattern for SRIOV physical port location code is XXXXX.XXX.XXXXXXX-P1-T1 or P1-T1.

capacity (optional, float, None)

Capacity value to be configured for vnic backing device. Default value is 2.0%.

hosting_partition (optional, str, None)

The VIOS name on which SRIOV physical port location code to be configured.

By default picks a random VIOS name with RMC state as active.

shutdown_option (optional, str, None)

Option to shutdown Logical Partition

This option is valid only for shutdown action.

Default value is Delayed.

restart_option (optional, str, None)

Option to reboot Logical Partition

This option is valid only for restart action.

Default value is Immediate.

state (optional, str, None)

present creates a partition of the specified os_type, vm_name, proc and memory on specified system_name.

absent deletes a partition of the specified vm_name.

facts fetch the details of the specified vm_name on specified system_name.

action (optional, str, None)

shutdown shutdown a partition of the specified vm_name on specified system_name.

poweron poweron a partition of the specified vm_name with specified prof_name, keylock, iIPLsource on specified system_name.

restart restart a partition of the specified vm_name on specified system_name.

install_os install Aix/Linux OS through NIM Server on specified vm_name.

Notes

Note

  • The network configuration currently will not support SRIOV configurations.

  • retain_vios_cfg and delete_vdisks options will only be supported from HMC release level on or above V9 R1 M930.

  • Partition creation is not supported for resource role-based user in HMC Version prior to 951.

  • install_os action doesn’t support installation of IBMi OS.

  • Only state=absent and action=install_os operations support passwordless authentication.

Examples

- name: Create an IBMi logical partition instance with shared proc, volume_config's vios_name and volume_name values, PhysicaIO and
        max_virtual_slots.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      vm_id: <lpar_id>
      proc: 4
      proc_unit: 4
      mem: 20480
      volume_config:
         - vios_name: <viosname1>
           volume_name: <volumename1>
         - vios_name: <viosname2>
           volume_name: <volumename2>
      physical_io:
         - <physicalIO location code>
         - <physicalio location code>
      max_virtual_slots: 50
      os_type: ibmi
      state: present

- name: Create an AIX/Linux logical partition instance with default proc, mem, virt_network_config, volume_config's volumes_size and
        npiv_config, vnic_config.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      volume_config:
         - volume_size: <disk_size>
         - volume_size: <disk_size>
      virt_network_config:
         - network_name: <virtual_nw_name>
           slot_number: <client_slot_no>
      npiv_config:
         - vios_name: <viosname>
           fc_port: <fc_port_name/loc_code>
           wwpn_pair: <wwpn1;wwpn2>
      vnic_config:
         - vnic_adapter_id: <vnic_adapter_id>
           backing_devices:
              - location_code: XXXXX.XXX.XXXXXXX-P1-T1
                capacity: <capacity>
                hosting_partition: <vios_name>
              - location_code: P1-T2
         - backing_devices:
              - location_code: P1-T3
                hosting_partition: <vios_name>
              - location_code: P1-T4
                capacity: <capacity>
         - vnic_adapter_id: <vnic_adapter_id>
      os_type: aix_linux
      state: present

- name: Delete a logical partition instance with retain_vios_cfg and delete_vdisk options.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      retain_vios_cfg: True
      delete_vdisks: True
      state: absent

- name: Shutdown a logical partition.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      action: shutdown

- name: Activate an AIX/Linux logical partition with user defined profile_name.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      prof_name: <profile_name>
      action: poweron

- name: Activate IBMi based on its current configuration with keylock and iIPLsource options.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      keylock: 'normal'
      iIPLsource: 'd'
      action: poweron

- name: Create a partition with all resources.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth:
         username: '{{ ansible_user }}'
         password: '{{ hmc_password }}'
      system_name: <system_name>
      vm_name: <vm_name>
      all_resources: True
      os_type: aix_linux
      state: present

- name: Install Aix/Linux OS on LPAR from NIM Server.
  powervm_lpar_instance:
      hmc_host: '{{ inventory_hostname }}'
      hmc_auth: "{{ curr_hmc_auth }}"
      system_name: <system_name>
      vm_name: <vm_name>
      install_settings:
         vm_ip: <IP_address of the lpar>
         nim_ip: <IP_address of the NIM Server>
         nim_gateway: <Gateway IP_Addres>
         nim_subnetmask: <Subnetmask IP_Address>
      action: install_os

Return Values

partition_info (on success for state C(present), dict, {‘AllocatedVirtualProcessors’: None, ‘AssociatedManagedSystem’: ‘<system-name>’, ‘CurrentMemory’: 1024, ‘CurrentProcessingUnits’: None, ‘CurrentProcessors’: 1, ‘Description’: None, ‘HasDedicatedProcessors’: ‘true’, ‘HasPhysicalIO’: ‘true’, ‘IsVirtualServiceAttentionLEDOn’: ‘false’, ‘LastActivatedProfile’: ‘default_profile’, ‘MemoryMode’: ‘Dedicated’, ‘MigrationState’: ‘Not_Migrating’, ‘OperatingSystemVersion’: ‘Unknown’, ‘PartitionID’: 11, ‘PartitionName’: ‘<partition-name>’, ‘PartitionState’: ‘not activated’, ‘PartitionType’: ‘AIX/Linux’, ‘PowerManagementMode’: None, ‘ProgressState’: None, ‘RMCState’: ‘inactive’, ‘ReferenceCode’: ‘’, ‘RemoteRestartState’: ‘Invalid’, ‘ResourceMonitoringIPAddress’: None, ‘SharingMode’: ‘sre idle proces’})

The configuration of the partition after creation

Status

  • This module is not guaranteed to have a backwards compatible interface. [preview]

  • This module is maintained by community.

Authors

  • Anil Vijayan (@AnilVijayan)

  • Navinakumar Kandakur (@nkandak1)