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

[pull] master from oravirt:master #48

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/420_yaml_indents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- "oradb_rman: Removed unwanted newlines from rman_backup.sh command line (oravirt#420)"
- "reviewed entire roles/ code basis and removed unwanted indents from yaml multiline blocks (oravirt#420)"
3 changes: 3 additions & 0 deletions changelogs/fragments/run_once.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "Replace run_once: _oraswgi_meta_configure_cluster with when condition ()"
20 changes: 12 additions & 8 deletions roles/oradb_manage_db/tasks/manage-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@
# loop_var dbh was replaced by odb in outer loop
# => no need to change all dbca-templates...
dbh: "{{ odb }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
when: odb.state == 'present'
when:
- odb.state == 'present'
- _orasw_meta_primary_node | bool
tags:
- create_db
- dbcatemplate
Expand Down Expand Up @@ -125,10 +126,11 @@
initparams: "{{ _oradb_manage_db_init_params_list | default(omit) }}"
output: verbose
state: "{{ odb.state }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
when: odb.state == 'present'
when:
- odb.state == 'present'
- _orasw_meta_primary_node | bool
register: dbca_create

rescue:
Expand Down Expand Up @@ -159,8 +161,9 @@

- ansible.builtin.debug:
msg: "Removing DB - {{ odb.oracle_db_name }}, ORACLE_HOME - {{ _oracle_home_db }}" # noqa name[missing]
run_once: "{{ _oraswgi_meta_configure_cluster }}"
when: odb.state == 'absent'
when:
- odb.state == 'absent'
- _orasw_meta_primary_node | bool

- name: manage_db | remove database
opitzconsulting.ansible_oracle.oracle_db:
Expand All @@ -171,10 +174,11 @@
db_name: "{{ odb.oracle_db_name }}"
output: verbose
state: "{{ odb.state }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
when: odb.state == 'absent'
when:
- odb.state == 'absent'
- _orasw_meta_primary_node | bool
register: dbca_remove
tags: remove_db,dbca

Expand Down
8 changes: 4 additions & 4 deletions roles/oradb_manage_grants/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
skip_missing: true
environment: "{{ _oracle_env_cdb }}"
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
- (odb.1.grants is defined or odb.1.object_privs is defined)
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
loop_control:
Expand Down Expand Up @@ -62,6 +62,7 @@
skip_missing: true
environment: "{{ _oracle_env_pdb }}"
when:
- _orasw_meta_primary_node | bool
- oracle_pdbs is defined
- opdb.0 is defined
- opdb.0.state == 'present'
Expand All @@ -70,7 +71,6 @@
- >-
oracle_databases | selectattr('oracle_db_name', 'equalto', opdb.0.cdb)
| map(attribute='state') | list | first == 'present'
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
loop_control:
Expand Down Expand Up @@ -110,11 +110,11 @@
skip_missing: true
environment: "{{ _oracle_env }}"
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
- (odb.1.grants is defined or odb.1.object_privs is defined)
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
loop_control:
Expand Down Expand Up @@ -151,6 +151,7 @@
skip_missing: true
environment: "{{ _oracle_env_pdb }}"
when:
- _orasw_meta_primary_node | bool
- oracle_pdbs is defined
- opdb.0 is defined
- opdb.0.state == 'present'
Expand All @@ -159,7 +160,6 @@
- >-
oracle_databases | selectattr('oracle_db_name', 'equalto', opdb.0.cdb)
| map(attribute='state') | list | first == 'present'
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
loop_control:
Expand Down
6 changes: 3 additions & 3 deletions roles/oradb_manage_parameters/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
state: "{{ odb.1.state }}"
scope: "{{ odb.1.scope | default ('both') }}"
environment: "{{ _oracle_env }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
with_subelements:
- "{{ oracle_databases }}"
- init_parameters
- flags:
skip_missing: true
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
Expand Down Expand Up @@ -57,13 +57,13 @@
state: "{{ opdb.1.state }}"
scope: "{{ opdb.1.scope | default ('both') }}"
environment: "{{ _oracle_env_pdb }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
with_subelements:
- "{{ oracle_pdbs }}"
- init_parameters
- flags:
skip_missing: true
when:
- _orasw_meta_primary_node | bool
- oracle_pdbs is defined
- opdb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
Expand Down Expand Up @@ -99,11 +99,11 @@
sid: "{{ _oracle_db_instance_name | default(omit) }}"
state: "restarted"
force_restart: false
run_once: "{{ _oraswgi_meta_configure_cluster }}"
with_nested:
- "{{ oracle_databases }}"
- "" # dummy to force odb.0 instead of item.
when:
- _orasw_meta_primary_node | bool
- odb.0.restart_spparameter_changed | default(true)
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
- restart_spparameter_changed
Expand Down
2 changes: 1 addition & 1 deletion roles/oradb_manage_pdb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
port: "{{ listener_port_template }}"
state: "{{ odb[1].state | default(omit) }}"
environment: "{{ _oracle_env }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
with_nested:
- "{{ oracle_databases }}"
- "{{ oracle_pdbs }}"
Expand All @@ -39,6 +38,7 @@
db_state: {{ oracledb_facts[_oracle_db_unique_name]['state'] | default('') }}
loop_var: odb
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb[0].oracle_db_name
- oracle_pdbs is defined
Expand Down
4 changes: 2 additions & 2 deletions roles/oradb_manage_profiles/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
attributes: {{ odb.1.attributes }}
db_state: {{ oracledb_facts[_oracle_db_unique_name]['state'] | default('') }}
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
- odb.1 is defined
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
vars:
Expand Down Expand Up @@ -88,6 +88,7 @@
attributes: {{ opdb.1.attributes }}
cdb_state: {{ oracledb_facts[_oracle_db_unique_name]['state'] | default('') }}
when:
- _orasw_meta_primary_node | bool
- oracle_pdbs is defined
- opdb.0 is defined
- opdb.0.state == 'present'
Expand All @@ -96,7 +97,6 @@
- >-
oracle_databases | selectattr('oracle_db_name', 'equalto', opdb.0.cdb)
| map(attribute='state') | list | first == 'present'
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
vars:
Expand Down
2 changes: 1 addition & 1 deletion roles/oradb_manage_redo/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
size: "{{ odb.redolog_size }}"
groups: "{{ odb.redolog_groups }}"
environment: "{{ _oracle_env }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
loop: "{{ oracle_databases }}"
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.redolog_size is defined
- odb.redolog_groups is defined
Expand Down
4 changes: 3 additions & 1 deletion roles/oradb_manage_roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Manage roles in Oracle

## Discovered Tags

**_users,grants_**
**_grants_**

**_users_**


## Dependencies
Expand Down
12 changes: 8 additions & 4 deletions roles/oradb_manage_roles/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
skip_missing: true
environment: "{{ _oracle_env }}"
when:
- _orasw_meta_primary_node | bool
- oracle_databases is defined
- odb.0.state == 'present'
- oracledb_facts[_oracle_db_unique_name]['state'] | default('') == 'present'
Expand All @@ -30,10 +31,11 @@
role {{ odb.1.name }}
state {{ odb.1.state }}
db_state: {{ oracledb_facts[_oracle_db_unique_name]['state'] | default('') }}
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
tags: users,grants
tags:
- users
- grants

- name: Manage roles (pdb)
opitzconsulting.ansible_oracle.oracle_role:
Expand All @@ -52,6 +54,7 @@
skip_missing: true
environment: "{{ _oracle_env_pdb }}"
when:
- _orasw_meta_primary_node | bool
- oracle_pdbs is defined
- opdb.0 is defined
- opdb.0.state == 'present'
Expand All @@ -69,7 +72,8 @@
role: {{ opdb.1.name }},
state: {{ opdb.1.state }}
cdb_state: {{ oracledb_facts[_oracle_db_unique_name]['state'] | default('') }}
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ oracle_user }}"
tags: users,grants
tags:
- users
- grants
6 changes: 4 additions & 2 deletions roles/oradb_manage_services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Manage services in Oracle

## Discovered Tags

**_create_service,services_**
**_create_service_**

**_start_service,services_**
**_services_**

**_start_service_**

## Open Tasks

Expand Down
Loading
Loading