VIOS Update gotchas
??????Andrey Klyachkin
#1 in Automating IBM Power and IBM AIX Infrastructure | POWER DevOps | IT Infrastructure Automation | Speaker | Trainer | Author | IBM Champion | IBM AIX Community Advocate
A week ago I wrote the article about IBM PowerVM VIOS update using Ansible. But there is a small problem with the playbook.
As you remember, I first commit all the updates which was previously installed on the VIO:
If there are uncommitted updates, everything is fine.
The problem comes if there are NO uncommitted updates:
The module ibm.power_vios.updateios executes the command updateios -commit and returns back the error. It is usual behaviour of updateios command and if you execute it manually, you understand that everything is OK and you can continue with your update.
Unfortunately Ansible doesn't have a head and brains of a human VIO administrator and it wants a little bit help from us.
The easiest way you could solve the problem is to add ignore_errors into the playbook:
It will work but it will ignore more errors as you wish. For example the following error will be ignored too:
In this case we have to drop off ibm.power_vios collection and use the standard Ansible shell module. Using the shell module we can define return codes which are "good" and should be ignored.
领英推荐
We register the result of the executed shell command in the variable result and then check the value of the return code saved in result.rc.
If return code is 0, 19 or 20, then the task was executed successfully and we can execute the next task.
If return code is NOT 0, 19 or 20, then the playbook must fail.
Why these return codes?
Return code 0 means everything worked without any problems. It is returned when there were uncommitted updates and they were successfully committed.
Return code 19 I saw on VIO 3.1.1 with the message "There are no uncommitted updates".
Return code 20 I saw on VIO 3.1.4 with the same message "There are no uncommitted updates".
I have no information how oft the return codes are changed and what their actual meanings are. If you have it, write it down in the comments. They worked for me and I did ca. 40 VIO updates last week using the playbook.
Have fun with VIO updates!
Andrey
[ Technical Leader Linux on Power | SVA | IBM Power Systems Plattform | PowerVC | Devops | AI | Opensource | Linux | Ansible ]
2 年Is there also a whole ansible role for this soon on github???