Skip to content

Commit

Permalink
oradb_manage_wallet: fixed wrong dbpassword assignment, added debug o…
Browse files Browse the repository at this point in the history
…ption for password
  • Loading branch information
Rendanic committed Jan 21, 2024
1 parent 6356166 commit 6044215
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/oradb_manage_wallet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "oradb_manage_wallet: fixed wrong dbpassword assignment, added debug option for password (oravirt#404)"
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ _tnsnames_config_pdb_helper:
- key: "{{ oracle_pdbs[0]['pdb_name'] }}"
alias:
- "{{ oracle_pdbs[0]['pdb_name'] }}_SYSTEM"
- "{{ oracle_pdbs[0]['pdb_name'] }}_PERFSTAT"
value:
connect:
service_name: "{{ oracle_pdbs[0]['pdb_name'] }}"
Expand Down Expand Up @@ -185,7 +186,11 @@ oracle_wallet_config:
state: present
# mode: g+rx
dbcredentials:
- tns_name: oracle_pdbs[0]['pdb_name']
db_name: oracle_pdbs[0]['pdb_name']
- tns_name: "{{ oracle_pdbs[0]['pdb_name'] }}_SYSTEM"
db_name: "{{ oracle_pdbs[0]['pdb_name'] }}"
db_user: system
state: present
- tns_name: "{{ oracle_pdbs[0]['pdb_name'] }}_PERFSTAT"
db_name: "{{ oracle_pdbs[0]['pdb_name'] }}"
db_user: perfstat
state: present
11 changes: 11 additions & 0 deletions roles/oradb_manage_wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Define a password for the wallet in `oracle_wallet_password`.
- [Default Variables](#default-variables)
- [oracle_wallet_config](#oracle_wallet_config)
- [oracle_wallet_password](#oracle_wallet_password)
- [oracle_wallet_show_password](#oracle_wallet_show_password)
- [Discovered Tags](#discovered-tags)
- [Dependencies](#dependencies)
- [License](#license)
Expand Down Expand Up @@ -63,6 +64,16 @@ oracle_wallet_password:
wallet2: <password>
```
### oracle_wallet_show_password
Show password during execution in loop label.
#### Default value
```YAML
oracle_wallet_show_password: false
```
## Discovered Tags
**_always_**
Expand Down
5 changes: 5 additions & 0 deletions roles/oradb_manage_wallet/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ oracle_wallet_config: []
# db_user: user1
# state: present
# @end

# @var oracle_wallet_show_password:description: >
# Show password during execution in loop label.
# @end
oracle_wallet_show_password: false
26 changes: 15 additions & 11 deletions roles/oradb_manage_wallet/tasks/wallet_manage_dbcredential.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"{{ owc.dbcredentials }}"
loop_control:
label: >-
{{ owc_d.tns_name | default('') }}
{{ owc_d.db_user | default('') }}
{{ owc_d.state | default('') }}
tns: {{ owc_d.tns_name | default('') }}
db_user: {{ owc_d.db_user | default('') }}
state: {{ owc_d.state | default('') }}
loop_var: owc_d
when:
- owc.dbcredentials is defined
Expand All @@ -43,7 +43,7 @@
wrl: "{{ owc.path }}"
tns_name: "{{ owc_d.tns_name }}"
db_user: "{{ owc_d.db_user }}"
password: "{{ _oradb_manage_wallet_password }}"
password: "{{ _oradb_manage_wallet_dbpassword }}"
ORACLE_HOME: "{{ _oracle_home_db }}"

# We cannot check for a changed password
Expand All @@ -60,9 +60,13 @@
"{{ owc.dbcredentials }}"
loop_control:
label: >-
{{ owc_d.tns_name | default('') }}
{{ owc_d.db_user | default('') }}
{{ owc_d.state | default('') }}
tns: {{ owc_d.tns_name | default('') }}
db_user: {{ owc_d.db_user | default('') }}
state: {{ owc_d.state | default('') }}
{% if oracle_wallet_show_password %}
dbpass: {{ _oradb_manage_wallet_dbpassword }}
walletpass: {{ _oradb_manage_wallet_password }}
{% endif %}
loop_var: owc_d
when:
- owc.dbcredentials is defined
Expand All @@ -75,7 +79,7 @@
wrl: "{{ owc.path }}"
tns_name: "{{ owc_d.tns_name }}"
db_user: "{{ owc_d.db_user }}"
password: "{{ _oradb_manage_wallet_password }}"
password: "{{ _oradb_manage_wallet_dbpassword }}"
ORACLE_HOME: "{{ _oracle_home_db }}"

- name: wallet_manage_dbcredential | Remove DB-Credentiaks # noqa no-changed-when
Expand All @@ -90,9 +94,9 @@
"{{ owc.dbcredentials }}"
loop_control:
label: >-
{{ owc_d.tns_name | default('') }}
{{ owc_d.db_user | default('') }}
{{ owc_d.state | default('') }}
tns: {{ owc_d.tns_name | default('') }}
db_user: {{ owc_d.db_user | default('') }}
state: {{ owc_d.state | default('') }}
loop_var: owc_d
when:
- owc.dbcredentials is defined
Expand Down
2 changes: 1 addition & 1 deletion roles/oradb_manage_wallet/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ _oradb_manage_wallet_dbpassword_loopvar: >-
{{ owc_dbc.1 | default(owc_d) }}
_oradb_manage_wallet_dbpassword: >-
{{ dbpasswords[_oradb_manage_wallet_password_loopvar.db_name][_oradb_manage_wallet_password_loopvar.db_user] | default(default_dbpass) }}
{{ dbpasswords[owc_d.db_name][owc_d.db_user] | default(default_dbpass) }}

0 comments on commit 6044215

Please sign in to comment.