oravirt/ansible-oracle

oradb_stats role does not work (db_service_name undefined)

bartowl opened this issue · 4 comments

This module expects db_service_name variable in main loop, yet provides only __db_service_name in its defaults. BTW should both not be single underscore? db_service_name might be defined by other roles, but when calling this role as the first one, following error is reported:
Failed to template loop_control.label: 'db_service_name' is undefined

One more error found:

The task includes an option with an undefined variable. The error was: {% if dbpasswords is defined
    and dbpasswords[odb.0.oracle_db_name] is defined
    and dbpasswords[odb.0.oracle_db_name][db_user] is defined -%}
    {{ dbpasswords[odb.0.oracle_db_name][db_user] }}
{%- else %}{{ default_dbpass }} {%- endif %}: 'db_user' is undefined

and indeed - in defaults __db_user is defined, but referenced db_user not.

Using latest release v3.10.0 od ansible-oracle

One more problem identified - in opitzconsulting.ansible_oracle.oracle_facts module password parameter is not marked as no_log=True, thus leaks passwords in json logs.

Hi Bartek,
the oradb_facts was developed for ansible-oracle4.0 and later backported to 3.9.
I had some issues due to the different loop_vars between the roles.
The whole defaults in ansible-oracle are not consistent over all roles.
I had to copy a lot into the defaults of oradb_facts and missed some of them, because they are part of other roles and I won't risk breaking ansible-oracleby adding more variables to orasw_meta.

It's extremly difficult to test each role in a single playbook to find the missing or wrong defaults.
The issue is not visible when manage-db.yml is executed - that's why I didn't saw the issue during my tests. :-(

The 2nd _ was added to prevent using the same variable from a different role - that won't really help. I am moving to vars instead of defaults in 4.0 for some situations but that isn't a global solution for ansible-oracle.

The code duplication with different loop_vars is the reason why I started the huge refactoring of all roles in 4.0.

Ok, i get it. For now i have anyway a viable solution found:

vars:
    db_service_name: "{{ __db_service_name }}"
    db_user: "{{ __db_user }}"

but I'm glad you did fix those small things. Will move on with 4.0. I know how pita is backporting stuff...
Thanks for fixing anyway!