We created AIX, Linux, or IBM i LPAR using Ansible. Or all of them. What should we do next? Install the operating system! Which one is your favorite? AIX or Linux? Mine is AIX ;-)
Let’s install AIX on an LPAR using Ansible.
Prerequisites
I hope you have a NIM server in your environment. It is something we usually have. If you don’t have it, sorry, this is not for you. Write a comment down or email me how you install AIX without NIM, and maybe next time you will get an Ansible playbook for it.
If we do a network installation, we must have IP parameters for the LPAR. IP address, netmask, and gateway must be there.
Should I mention that you need to know the LPAR name, the managed system it resides on, and the HMC credentials?
vars:
hmc: hmc.power-devops.cloud
hmc_auth:
username: hscroot
password: P@ssw0rd
managed_system: E1180-9080-HEU
lpar: aixtest
lpar_ip: 10.10.10.10
lpar_netmask: 255.255.255.0
lpar_gw: 10.10.10.1
nim_ip: 10.9.9.9
Install it!
We use the same ibm.power_hmc.powervm_lpar_instance module as we used to create the LPAR, but with different parameters:
- name: Start installation
ibm.power_hmc.powervm_lpar_instance:
hmc_host: "{{ hmc }}"
hmc_auth: "{{ hmc_auth }}"
system_name: "{{ managed_system }}"
vm_name: "{{ lpar }}"
install_settings:
vm_ip: "{{ lpar_ip }}"
nim_ip: "{{ nim_ip }}"
nim_gateway: "{{ lpar_gw }}"
nim_netmask: "{{ lpar_netmask }}"
action: install_os
I don’t know why IBM developers decided to name parameters “nim_gateway” and “nim_netmask”. If you look into the documentation, they are the LPAR gateway and the LPAR netmask.
The installation starts,… and doesn’t work ;-)
Why?
Before we start the installation, we must prepare our NIM environment and assign installation resources to the server.
Creating NIM machine definition
In a some brilliant future world, we will do it by using ibm.power_aix collection like:
- name: Define NIM client
ibm.power_aix.nim_resource:
name: "{{ lpar }}"
object_type: standalone
action: create
attributes:
if1: "find_net {{ lpar }} 0"
platform: chrp
netboot_kernel: 64
connect: nimsh
Unfortunately, the current version of the collection doesn’t support it.
That’s why we use the ansible.builtin.command module.
We first check if the object is already defined:
- name: Check if NIM client is already defined
ansible.builtin.command:
cmd: "lsnim -l {{ lpar }}"
failed_when: false
changed_when: false
register: nimobj
If it is not defined, we define it:
- name: Define NIM client
ansible.builtin.command:
cmd: "nim -o define -t standalone -a if1=\"find_net {{ lpar }} 0\" -a platform=chrp -a netboot_kernel=64 -a connect=nimsh {{ lpar }}"
changed_when: nimdef.rc == 0
when: nimobj.rc != 0
register: nimdef
Assign installation resources
I don’t know how you do it, but I usually select the installation resources step by step, and mostly I use lpp_source for a fresh AIX installation.
The Ansible collection ibm.power_aix doesn’t work with single resources. It requires that we use a resource_group object. That’s why we must first define it with all NIM objects we need for the installation.
Don’t be afraid. If you already defined it once, it will not be redefined.
- name: Define resource group for 7300-03-01-2520
ibm.power_aix.nim_resource:
name: 7300-03-01-2520-resgrp
object_type: res_group
action: create
attributes:
mksysb: 7300-03-01-2520-mksysb
spot: 7300-03-01-2520-spot
bosinst_data: bosinst_data_aix
image_data: image_data_aix
resolv_conf: resolv_conf_aix
fb_script: fb_aix
After the resource group is defined, we can assign it to our machine object and start the bos_inst operation. Don’t forget to disable the reboot of the machine! We start the LPAR through HMC by using the task above.
- name: Prepare bos_inst
ibm.power_aix.nim:
action: bos_inst
targets: “{{ lpar }}”
group: 7300-03-01-2520-resgrp
boot_client: false
What about lpp_source installation?
You can use the same principle as before, but use the command nim to start bos_inst.
First, define the resource group:
- name: Define resource group for 7300-03-01-2520
ibm.power_aix.nim_resource:
name: 7300-03-01-2520-resgrp
object_type: res_group
action: create
attributes:
lpp_source: 7300-03-01-2520-mksysb
spot: 7300-03-01-2520-spot
bosinst_data: bosinst_data_aix
image_data: image_data_aix
resolv_conf: resolv_conf_aix
fb_script: fb_aix
Then, allocate the resources and set the machine into bos_inst mode:
- name: Prepare bos_inst
ansible.builtin.command:
cmd: "nim -o bos_inst -a source=rte -a group=7300-03-01-2520-resgrp -a boot_client=no {{ lpar }}"
Support the Power DevOps Newsletter!
If you like reading technical articles about IBM Power, AIX, and Linux on IBM Power, consider upgrading to the paid tier to show your support. As a paid subscriber, you not only get regular posts, but you will get additional posts with the full code and further explanations, access to the whole archive of the blog, and take part in our monthly calls where you can ask your questions and propose topics for future newsletters. Be an active member of our community!
Is it already running?
AIX installation can be a long process. Depending on the resources you have in your LPAR, it can take several minutes. But if you defined all resources, created the playbook, and added it to the Ansible Automation Platform, you can delegate it to someone else. This is not your problem anymore! ;-)
You now have everything to automate AIX deployments. You can create LPARs and install AIX using a mksysb image or an lpp_source.
Have fun installing AIX!
Andrey
Hi, I am Andrey Klyachkin, IBM Champion and IBM AIX Community Advocate. This means I don’t work for IBM. Over the last twenty years, I have worked with many different IBM Power customers all over the world, both on-premise and in the cloud. I specialize in automating IBM Power infrastructures, making them even more robust and agile. I co-authored several IBM Redbooks and IBM Power certifications. I am an active Red Hat Certified Engineer and Instructor.
Follow me on LinkedIn, Twitter and YouTube.
You can meet me at events like IBM TechXchange, the Common Europe Congress, and GSE Germany’s IBM Power Working Group sessions.