oravirt / ansible-oracle

Oracle related stuff. Installs RAC/RAC One Node/Single Instance
MIT License
342 stars 249 forks source link

Patching error when using oraswdb_manage_patches_force_opatch_upgrade: true #478

Open talek opened 1 day ago

talek commented 1 day ago

Hello,

Reading the logic behind, my understanding is that oraswdb_manage_patches role skips reading OPatch version when "oraswdb_manage_patches_force_opatch_upgrade: true" but later on the OPatch version is needed for some of the subsequent tasks?

...
TASK [opitzconsulting.ansible_oracle.oraswgi_meta : ansible-oracle Collection version] ***                                                                                                                                            
Friday 27 September 2024  12:24:38 +0300 (0:00:00.026)       0:00:03.058 ******                                                                                                                                                       
ok: [swdb-molecule] => {                                                                                                                                                                                                              
    "msg": "ansible-oracle version: 4.11.0"                                                                                                                                                                                           
}   

...

TASK [opitzconsulting.ansible_oracle.oraswdb_manage_patches : db_opatch | Check current opatch version] ***                                                                                                                           
Friday 27 September 2024  12:25:07 +0300 (0:00:00.044)       0:00:31.755 ******                                                                                                                                                       
skipping: [swdb-molecule] 

...

TASK [opitzconsulting.ansible_oracle.oraswdb_manage_patches : List of current installed patches] ***                                                                                                                                  Friday 27 September 2024  12:25:15 +0300 (0:00:04.296)       0:00:39.983 ******                                                                                                                                                       
ok: [swdb-molecule] => {
    "dbhome_patches.stdout_lines": [                                                                               
        "35648110;OJVM RELEASE UPDATE: 19.21.0.0.231017 (35648110)",
        "35643107;Database Release Update : 19.21.0.0.231017 (35643107)",       
        "29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)",                                                      
        "",
        "OPatch succeeded."                                                                                        
    ]                                                                                                              
}                                                                                                                  

TASK [opitzconsulting.ansible_oracle.oraswdb_manage_patches : reset state for opatch inventory refresh] ***
Friday 27 September 2024  12:25:15 +0300 (0:00:00.034)       0:00:40.018 ******
ok: [swdb-molecule]                                                                                                

TASK [opitzconsulting.ansible_oracle.oraswdb_manage_patches : Configure ocm.rsp (1)] ***                          
Friday 27 September 2024  12:25:15 +0300 (0:00:00.036)       0:00:40.054 ******
fatal: [swdb-molecule]: FAILED! => {"msg": "The conditional check 'current_opatch_version.msg is version_compare('12.2.0.1.5', '<')' failed. The error was: error while evaluating conditional (current_opatch_version.msg is version_
compare('12.2.0.1.5', '<')): 'dict object' has no attribute 'msg'. 'dict object' has no attribute 'msg'\n\nThe error appears to be in '/Users/talek/.ansible/collections/ansible_collections/opitzconsulting/ansible_oracle/roles/oras
wdb_manage_patches/tasks/loop_db-home-patch.yml': line 14, 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: Configure ocm.rsp (1)\n  ^ here\n"

Is this a bug? Thanks!

Regards, Alec

Rendanic commented 1 day ago

Hi Alec, I am not sure but I found possible reasons for this issue. The main reason for oraswdb_manage_patches_force_opatch_upgrade is the new prepatch install feature during ORACLE_HOME installation. We need to update OPatch for the apply of a RU during installation but we can't read the version with opatch version , because the home is not registered yet. I force the update in this situation to update the OPatch utility. This is only ecevuted once for each ORACLE_HOME.

It is possible that current_opatch_version is defined, when the role oraswgi_manage_patches has been executed during the same play or you try to installe multiple ORACLE_HOMEs during 1 play.

Regards Thorsten

Rendanic commented 1 day ago

469

talek commented 9 hours ago

Hi Thorsten,

Ok, it makes sense. Thanks for shedding some light on this.

The scenario I'm using is quite simple: I'm invoking swdb.yml playbook, trying to install Oracle 19.21 against a rhel9 molecule vm (no multiple oracle homes, just a simple inventory inspired by your example/beginner_patching). Starting with 19.21, we shouldn't need any workarounds on rhel9, since it's working flawless with the default oraswdb_manage_patches_force_opatch_upgrade: false anyway. Still, if I want to force OPatch upgrade, I end up with this error which, if I don't miss something, it shouldn't happen. I like the idea of forcing OPatch upgrade, but it should work outside of prepatch install feature as well.

Regards, Alec