Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oradb_stats role does not work (db_service_name undefined) #364

Closed
bartowl opened this issue Jul 26, 2023 · 4 comments · Fixed by #366
Closed

oradb_stats role does not work (db_service_name undefined) #364

bartowl opened this issue Jul 26, 2023 · 4 comments · Fixed by #366
Labels
Milestone

Comments

@bartowl
Copy link
Contributor

bartowl commented Jul 26, 2023

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

@bartowl
Copy link
Contributor Author

bartowl commented Jul 26, 2023

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

@bartowl
Copy link
Contributor Author

bartowl commented Jul 26, 2023

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.

@Rendanic
Copy link
Collaborator

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.

@bartowl
Copy link
Contributor Author

bartowl commented Jul 27, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants