AIX Open Source

 View Only
Expand all | Collapse all

Ansilbe throws errors: "The conditional check 'nimadm_phases_to_run is regex(\"[^0-9,]\") or nimadm_phases_to_run[-1] == ',''" while run playbook to updating AIX 7.3 Service pack.

  • 1.  Ansilbe throws errors: "The conditional check 'nimadm_phases_to_run is regex(\"[^0-9,]\") or nimadm_phases_to_run[-1] == ',''" while run playbook to updating AIX 7.3 Service pack.

    Posted Thu May 09, 2024 03:50 AM

    ENV: 
        - NIM server: (hostname: efsnim-p1, AIX version: 7300-02-01-2346)
        - NIM client: (hostname: lpar112, AIX version: 7300-02-00-0000)    
        
    NIM LPP_SOURCE, SPOT, NIM client and lspv on nimclinent information.

        root@efsnim-p1:/root> lsnim -l -l lpp_source_aix73
        lpp_source_aix73:
           class        = resources
           type         = lpp_source
           arch         = power
           Rstate       = ready for use
           prev_state   = unavailable for use
           location     = /export/lpp_source/lpp_source_aix73
           simages      = yes
           alloc_count  = 0
           server       = master
           date_updated = Fri Apr 12 02:47:12 2024

        root@efsnim-p1:/root> lsnim -l -l spot_aix73
        spot_aix73:
           class         = resources
           type          = spot
           plat_defined  = chrp
           arch          = power
           bos_license   = yes
           Rstate        = ready for use
           prev_state    = verification is being performed
           location      = /export/spot/spot_aix73/usr
           version       = 7
           release       = 3
           mod           = 2
           oslevel_r     = 7300-02
           oslevel_s     = 7300-02-01-2346
           alloc_count   = 0
           server        = master
           if_supported  = chrp.64 ent
           Rstate_result = success
           date_updated  = Fri Apr 12 02:56:59 2024

        root@efsnim-p1:/root> lsnim -l -l lpar112
        lpar112:
           class           = machines
           type            = standalone
           installed_image = efsesb-ap1-p1_20240411_mksysb
           connect         = nimsh
           platform        = chrp
           netboot_kernel  = 64
           if1             = network1 lpar112 0
           cable_type1     = N/A
           Cstate          = ready for a NIM operation
           prev_state      = currently running
           Mstate          = not running
           cpuid           = 00C117E04B00
           Cstate_result   = success

        root@efsnim-p1:/root> lspv
        hdisk0          00c117e0c533bd6e                    rootvg          active
        hdisk1          00c117e0cea7a3c0                    nimvg           active
        root@efsnim-p1:/root> lsvg -l nimvg
        nimvg:
        LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
        explv               jfs2       199     199     1    open/syncd    /export
        root@efsnim-p1:/root>


        root@lpar112:/root> lspv
        hdisk0          00c117e00a7d7827                    rootvg          active
        hdisk1          none                                None
        root@lpar112:/root>


    Ansible on Control node and ibm.power_aix 1.8.3 collection.

        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$ ansible --version
        ansible [core 2.14.13]
          config file = /home/ckansible/ck-ans-02/ansible.cfg
          configured module search path = ['/home/ckansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
          ansible python module location = /opt/freeware/lib/python3.9/site-packages/ansible
          ansible collection location = /home/ckansible/ck-ans-02/ibmcollections:/usr/share/ansible/collections
          executable location = /opt/freeware/bin/ansible.orig
          python version = 3.9.16 (main, Jun 28 2023, 12:45:03) [GCC 8.3.0] (/opt/freeware/bin/python3.9)
          jinja version = 3.1.2
          libyaml = False
        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$ ansible-galaxy collection list

        # /home/ckansible/ck-ans-02/ibmcollections/ansible_collections
        Collection    Version
        ------------- -------
        ibm.power_aix 1.8.3

        # /opt/freeware/lib/python3.9/site-packages/ansible_collections
        Collection                    Version
        ----------------------------- -------
        amazon.aws                    5.2.0
        ...

    Playbook, by reference "Migrating to AIX 7.3 with nimadm and Ansible" in url: https://community.ibm.com/community/user/power/blogs/chris-gibson1/2024/03/13/migrating-to-aix-73-with-nimadm-and-ansible

        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$ cat playbooks/cg_nim_alt_disk_migration_lpar112_hdisk0.yml
        ---
        - name: "CK-PB - NIMADM playbook - Upgrading SP on AIX 7.3 TL02 SP00 to 7300-02-01-2346 with nimadm and Ansible"
          hosts: lpar112
          gather_facts: no

          collections:
            - ibm.power_aix
          tasks:
            - include_role:
                name: nim_alt_disk_migration
                apply:
                  delegate_to: efsnim-p1
              vars:
                nimadm_cache_vg: nimvg
                nim_client: lpar112
                target_disk:
                  disk_name: hdisk1
                lpp_source: lpp_source_aix73
                spot: spot_aix73
              register: nimadm_results

            - name: "T-1 - Debug: nimadm_results"
              ansible.builtin.debug: var=nimadm_results
        ...
        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$

    Run playbook and errors.
        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$ ansible-playbook playbooks/cg_nim_alt_disk_migration_lpar112_hdisk0.yml -u root --private-key=./devops_key/devops_id_ed25519

        PLAY [CK-PB - NIMADM playbook - Upgrading SP on AIX 7.3 TL02 SP00 to 7300-02-01-2346 with nimadm and Ansible] *************************************************************************

        TASK [include_role : nim_alt_disk_migration] ******************************************************************************************************************************************

        TASK [ibm.power_aix.nim_alt_disk_migration : Validating arguments against arg spec 'main' - This role is used to migrate a client OS levels from AIX 7.1/7.2 to AIX 7.3.] *************
        ok: [lpar112 -> efsnim-p1]

        TASK [ibm.power_aix.nim_alt_disk_migration : Fail if a NIM LPP resource is not specified] *********************************************************************************************
        skipping: [lpar112]

        TASK [ibm.power_aix.nim_alt_disk_migration : debug] ***********************************************************************************************************************************
        ok: [lpar112 -> efsnim-p1] => {
            "msg": "LPP resource lpp_source_aix73 specified for migration"
        }

        TASK [ibm.power_aix.nim_alt_disk_migration : Check if CacheVG 'nimvg' exists] *********************************************************************************************************
        ok: [lpar112 -> efsnim-p1]

        TASK [ibm.power_aix.nim_alt_disk_migration : Fail when '{{ nimadm_phases_to_run }}' contains invalid characters] **********************************************************************
        fatal: [lpar112 -> efsnim-p1]: FAILED! => {"msg": "The conditional check 'nimadm_phases_to_run is regex(\"[^0-9,]\") or nimadm_phases_to_run[-1] == ','' failed. The error was: error while evaluating conditional (nimadm_phases_to_run is regex(\"[^0-9,]\") or nimadm_phases_to_run[-1] == ','): 'nimadm_phases_to_run' is undefined. 'nimadm_phases_to_run' is undefined\n\nThe error appears to be in '/home/ckansible/ck-ans-02/ibmcollections/ansible_collections/ibm/power_aix/roles/nim_alt_disk_migration/tasks/main.yml': line 20, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Fail when '{{ nimadm_phases_to_run }}' contains invalid characters\"\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

        PLAY RECAP ****************************************************************************************************************************************************************************
        lpar112                    : ok=3    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0

        [ckansible@efsnim-p1:/home/ckansible/ck-ans-02]$

    Regards,

    Charin Kumjudpai.



    ------------------------------
    CHARIN KUMJUDPAI
    ------------------------------


  • 2.  RE: Ansilbe throws errors: "The conditional check 'nimadm_phases_to_run is regex(\"[^0-9,]\") or nimadm_phases_to_run[-1] == ',''" while run playbook to updating AIX 7.3 Service pack.

    Posted Thu May 09, 2024 05:15 AM

    Hi Charin,
    Pease open a defect on our GitHub repository - https://github.com/IBM/ansible-power-aix
    We track the issues/defects from there itself.



    ------------------------------
    Shreyansh Chamola
    ------------------------------