PowerVM

 View Only
  • 1.  Ansible ibm.power_hmc hmc_update_upgrade behaviour

    Posted Tue April 23, 2024 07:47 AM

    Hello IBM Power community, 

    currently doing my first steps with the ansible module ibm.power_hmc to update/upgrade HMCs without manual intervention. However I noticed several (from my peerspective) unexpected behaviour of the playbook. Due to lack of experience in this area I am unsure where this comes from ... so I'd appreciate if the experts in this community might be able help me to understand what is going on. 

    ibm.power_hmc module is on version 1.8.2 

    Situation : 

    Update HMC with MF71686 that is located on nim server, accessed via sftp 

    Playbook task : 

    -name: Update the HMC to the build level using disk
        hmc_update_upgrade:
              hmc_host: "{{ hmc_ip }}"
              hmc_auth: "{{ curr_hmc_auth }}"
              build_config:
                location_type: sftp
                hostname: <nim server>
                build_file: <path_to_iso>/MF71686_ppc.iso
                userid: <nim_user>
                sshkey_file: <path_to>id_rsa

    state: updated

    Update works as expected, file is transfered from the nim server and HMC is patched and reboots, checking the installed fixes proves successful pacthing. 

    Questions : 

    1) If the playbook is excuted a second time the patch is installed again and the HMC reboots again. I would have expected with  state: updated nothing to happen since it is already installed. 

    2) Despite the HMC is back after the patch installation and following reboot (accessible via ssh) the playbook does not continue to the next task. Running the playbook with -vvv (output below) hangs forever and can only be killed on the control node. 

    TASK [Update the HMC to the build level using disk] *******************************************************************************************************************************
    task path: /home/ansi4infra/collector/hmc_update.yml:88
    <si519hmcpoc> ESTABLISH LOCAL CONNECTION FOR USER: xxxxxxxx
    <si519hmcpoc> EXEC /bin/sh -c 'echo ~xxxxxxx && sleep 0'
    <si519hmcpoc> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/xxxxxxx/.ansible/tmp `"&& mkdir "` echo /home/xxxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203 `" && echo ansible-tmp-1713869442.0161397-2077082-74975833456203="` echo /home/xxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203 `" ) && sleep 0'
    Using module file /home/xxxxxxxx/.ansible/collections/ansible_collections/ibm/power_hmc/plugins/modules/hmc_update_upgrade.py
    <si519hmcpoc> PUT /home/xxxxxxxx/.ansible/tmp/ansible-local-2077039bedgmhg1/tmp1b53jbqt TO /home/xxxxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203/AnsiballZ_hmc_update_upgrade.py
    <si519hmcpoc> EXEC /bin/sh -c 'chmod u+x /home/xxxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203/ /home/xxxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203/AnsiballZ_hmc_update_upgrade.py && sleep 0'
    <si519hmcpoc> EXEC /bin/sh -c '/usr/bin/python3 /home/xxxxxxx/.ansible/tmp/ansible-tmp-1713869442.0161397-2077082-74975833456203/AnsiballZ_hmc_update_upgrade.py && sleep 0'

    <hangs forever>

    Thanks a lot for any response that helps me to understand what is going wrong. 

    Kind Regards, Volker 



    ------------------------------
    Volker Demand
    ------------------------------


  • 2.  RE: Ansible ibm.power_hmc hmc_update_upgrade behaviour

    IBM Champion
    Posted Wed April 24, 2024 03:39 AM

    Hi Volker,

    great that you started automating your IBM Power environment with Ansible!

    Even if it is very desirable not every module in Ansible collections is idempotent. You are right, a module should usually not change something if it is already implemented. But sometimes it is difficult to check for the module's developers and it is your responsibility as an automation developer to understand your environment and to implement such check.

    You can check my way of HMC updates and upgrades with Ansible in the video - https://www.youtube.com/watch?v=dWSPUXoRmYY. As you'll see in the video, I first check the version of the HMC and if there are known updates for it. It will be a little bit more difficult to check each HMC PTF and if it is needed at all.

    As a side note - there is a special Power Automation community. I'd encourage you to post your questions about Ansible there.

    Have a lot of fun automating your environment!



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 3.  RE: Ansible ibm.power_hmc hmc_update_upgrade behaviour

    Posted Wed April 24, 2024 06:39 AM

    Hi Andrey, 

    thanks a lot for your reply ! I did implement a workaround with the help of my inventory collector (we are using a mongo DB as inventory) so the inventory knows the already implemented patches of the HMC, with this I can avoid multiple patch installations. Appreciate the link to the great video ! Got lots of ideas of what can be automated in our environment ! 

    And finally ...thanks for the Power Automation Community hint  :-) 

    Regards, Volker 



    ------------------------------
    Volker Demand
    ------------------------------