Of course, I’ve heard about IBM i. Many of my friends use it on a daily basis. But me? I have an account on PUB400. By the way, if you want to test what IBM i is, this is the first site to visit - https://pub400.com. Thanks to Holger Scherer, who made it possible. OK, I have some more test LPARs with IBM i.
The funniest story in my professional life is connected to IBM i. At the time of IBM POWER6, I worked at IBM Managed Services and deployed systems for IBM customers. One of the customers had (they still have) a huge application on IBM i, and we had to deploy IBM i for them. Sellers sold them a completely virtualized solution with several 570s where IBM i and AIX should reside together. I was responsible for the virtualization infrastructure and deployment of AIX LPARs.
But our IBM i colleagues never heard about PowerVM and virtualization. Remember, it was the time of POWER6, and IBM i V6R1 was the first version that could be virtualized. They had never worked with HMC or VIOS and couldn’t even imagine what it's like to work with them.
The management decision was made quickly, and as usual in such cases, it was wrong. Are you responsible for the virtualization? It means you can install a virtualized IBM i!
I didn’t say no. I did what I could and installed IBM i.
Of course, it was not a complete and properly installed IBM i. Every seasoned IBM i expert would find many mistakes or missing settings in that installation. I still have problems configuring TCP/IP on IBM i, and I do it only if I have my cheat sheet with me.
But I learned something about IBM i.
Today, I see a similar problem with IBM i and Ansible. Many IBM i administrators don’t even want to touch Ansible, because … Because they don’t know it and are afraid to feel young again.
You know this feeling. You are the youngest member in the team. It means nobody expects high performance from you, and you get the dirtiest tasks, because you must learn something, and nobody else wants to do them.
You feel stupid because you can’t solve a problem or do something that everyone else can. Nobody tells you that they gave the task to you, because they don’t know how to do it and are afraid of making a fool of themselves.
But what can happen if you don’t do something right?
You stand up and say: “I did my best, but I couldn’t do it.”
It seems to be the most difficult words in life for adults. But why? The world didn’t crash, and the sun is still shining (not in Germany today).
Learn Ansible! It helps to solve tasks quickly.
Visit IBM TechXchange in Orlando! You can meet many experts there and ask your questions.
Let’s create an IBM i LPAR with Ansible
No, I will not get through each IBM i use case and automate it with Ansible, as I’d like to do with AIX. But I want to create my IBM i LPARs from time to time.
The only difference is the attribute os_type. It must be set to ibmi:
os_type: ibmi
Thanks to Mark Steele for pointing it out to me!
I usually did some more operations. E.g., IBM i has four different load sources - A, B, C, D. If you want to install your IBM i LPAR, you usually want to use the load source D:
iIPLsource: d
Mark wrote to me that he doesn’t use the option for IBM i LPARs.
I decided to drop the option, and… it works!
It made my playbooks for LPAR creation so straightforward. I need only to specify which type of LPAR I want to create:
---
- name: Create an IBM Power LPAR
hosts: localhost
gather_facts: false
vars:
hmc: myhmc
hmc_auth:
username: myuser
password: mypassword
lpar:
name: mylpar
system: mysystem
memory: 16384
vcpus: 4
proc_units: 4.0
network: mynetwork
root_hdisk: hdisk666
vios1: myvios
ostype: ibmi # or aix_linux
tasks:
- name: Create an LPAR
ibm.power_hmc.powervm_lpar_instance:
hmc_host: "{{ hmc }}"
hmc_auth: "{{ hmc_auth }}"
system_name: "{{ lpar.system }}"
vm_name: "{{ lpar.name }}"
min_mem: 2048
mem: "{{ lpar.memory }}"
max_mem: "{{ lpar.memory * 2 }}"
min_proc_unit: 0.1
proc_unit: "{{ lpar.proc_units }}"
max_proc_unit: "{{ lpar.proc_units * 2 }}"
min_proc: 1
proc: "{{ lpar.vcpus }}"
max_proc: "{{ lpar.vcpus * 2 }}"
proc_mode: uncapped
volume_config:
- volume_name: "{{ lpar.root_hdisk }}"
vios_name: "{{ lpar.vios1 }}"
virt_network_config:
- network_name: "{{ lpar.network }}"
os_type: "{{ lpar.ostype }}"
state: present
Was it everything?
Not really.
I usually install IBM i from a virtual CD device. I must create it if I create an IBM i LPAR. Of course, it must be created on VIOS.
- name: Create CD device for IBM i LPAR
when: lpar.ostype == "ibmi"
delegate_to: "{{ lpar.vios1 }}"
vars:
ansible_user: ansible
ansible_python_interpreter: /usr/bin/python3
block:
But before creating it, we must check if it already exists. Some playbooks are started many times:
- name: Check if CD device exists
ansible.builtin.command:
cmd: "/usr/ios/cli/ioscli lsdev -dev {{ lpar.name }}cd"
failed_when: false
changed_when: false
register: cddev
If the CD device doesn’t exist, we must find a vhost device to map the new CD device to. To do it, we first collect VIOS VSCSI mappings:
- name: Get mappings from VIOS
ibm.power_vios.mapping_facts:
component: vscsi
cpid: "{{ lparinfo.partition_info.PartitionID }}"
when: cddev.stdout_lines | length == 0
Then we simply use the first vhost found:
- name: Set vhost device
ansible.builtin.set_fact:
vhost: "{{ ansible_facts.mappings.vscsi.keys() | first }}"
when: cddev.stdout_lines | length == 0
I am pretty sure that I will find one because I created my LPAR with VSCSI disks.
If you use NPIV, it can be more difficult. Because there is no way to specify that you want a virtual optical device in ibm.power_hmc.powervm_lpar_instance module. There is also no way to tell it, that you want to have an empty VSCSI host without any mappings.
The only way I know is to use the chhwres HMC command to create a new VSCSI host on VIOS and your LPAR. It is not so easy. Maybe we should create a feature request to the ibm.power_hmc collection.
The last step is to create the virtual optical device:
- name: Create virtual CD device
ansible.builtin.command:
cmd: "/usr/ios/cli/ioscli mkvdev -fbo -vadapter {{ vhost }} -dev {{ lpar.name }}cd"
when: cddev.stdout_lines | length == 0
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!
Now it was everything!
The LPAR is there and ready to be installed. Don’t ask me how to install IBM i in an automated manner. It seems that 2025 it is the only operating system that cannot be installed fully automatically.
Still, it has many other beautiful features. If you like it, you know now how to create an IBM i LPAR using Ansible.
Create it!
Have fun deploying IBM i!
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.