Skip to content

Commit f3d8a24

Browse files
committed
oraswdb_manage_patches: ansible-lint
1 parent 532edc4 commit f3d8a24

File tree

5 files changed

+63
-61
lines changed

5 files changed

+63
-61
lines changed

roles/oraswdb_manage_patches/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ nfs_server_sw_path: /path/to/orasw
2020

2121
oracle_stage: /u01/stage
2222
oracle_stage_remote: "{{ oracle_stage }}"
23-
oracle_stage_install: "{% if not oracle_sw_copy and not oracle_sw_unpack%}{{ oracle_stage_remote }}{% else %}{{ oracle_stage }}{% endif %}"
23+
oracle_stage_install: "{% if not oracle_sw_copy and not oracle_sw_unpack %}{{ oracle_stage_remote }}{% else %}{{ oracle_stage }}{% endif %}"
2424
oracle_base: /u01/app/oracle
2525
oracle_rsp_stage: "{{ oracle_stage }}/rsp"
2626
oracle_patch_stage: "{{ oracle_stage }}/patches"
2727
oracle_patch_stage_remote: "{{ oracle_stage_remote }}/patches"
28-
oracle_patch_install: "{% if not oracle_sw_copy and not oracle_sw_unpack%}{{ oracle_patch_stage_remote }}{% else %}{{ oracle_patch_stage }}{% endif %}"
28+
oracle_patch_install: "{% if not oracle_sw_copy and not oracle_sw_unpack %}{{ oracle_patch_stage_remote }}{% else %}{{ oracle_patch_stage }}{% endif %}"
2929
oracle_inventory_loc: /u01/app/oraInventory
3030
ocm_response_file: "{{ oracle_patch_stage }}/{{ db_version }}/ocm.rsp"
3131

roles/oraswdb_manage_patches/tasks/db-home-patch.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
- ansible.builtin.set_fact: # noqa unnamed-task
3-
oracle_home_db: "{%- if db_homes_config[dbh.home]['oracle_home'] is defined -%}
4-
{{ db_homes_config[dbh.home]['oracle_home'] }}
5-
{%- else -%}
6-
{{ oracle_base }}/{{ db_homes_config[dbh.home]['version'] }}/{{ db_homes_config[dbh.home]['home'] }}
3+
oracle_home_db: "{%- if db_homes_config[dbh.home]['oracle_home'] is defined -%}\
4+
{{ db_homes_config[dbh.home]['oracle_home'] }}\
5+
{%- else -%}\
6+
{{ oracle_base }}/{{ db_homes_config[dbh.home]['version'] }}/{{ db_homes_config[dbh.home]['home'] }}\
77
{%- endif -%}"
88

99
- ansible.builtin.debug: msg="Managing patches for {{ oracle_home_db }}"
@@ -42,18 +42,18 @@
4242
- ocmconfig
4343

4444
- name: db_opatch | Remove unwanted patches from DB
45-
oracle_opatch:
46-
oracle_home={{ oracle_home_db }}
47-
patch_base={{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default (item.patchid) }}/
48-
patch_id={{ item.patchid }}
49-
patch_version={{ item.patchversion | default(omit) }}
50-
exclude_upi={{ item.excludeUPI | default(omit) }}
51-
opatchauto=False
52-
conflict_check=True
53-
stop_processes={{ item.stop_processes | default(False) }}
54-
ocm_response_file={{ ocm_response_file | default(omit) }}
55-
output=verbose
56-
state={{ item.state }}
45+
opitzconsulting.ansible_oracle.oracle_opatch:
46+
oracle_home: "{{ oracle_home_db }}"
47+
patch_base: "{{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default(item.patchid) }}/"
48+
patch_id: "{{ item.patchid }}"
49+
patch_version: "{{ item.patchversion | default(omit) }}"
50+
exclude_upi: "{{ item.excludeUPI | default(omit) }}"
51+
opatchauto: false
52+
conflict_check: true
53+
stop_processes: "{{ item.stop_processes | default(False) }}"
54+
ocm_response_file: "{{ ocm_response_file | default(omit) }}"
55+
output: verbose
56+
state: "{{ item.state }}"
5757
with_items:
5858
- "{{ db_homes_config[dbh.home]['opatch'] }}"
5959
become: true
@@ -67,7 +67,7 @@
6767
register: psuapplym
6868

6969
- name: db_opatch | Manage opatchauto patches for DB (non-gi)
70-
oracle_opatch:
70+
opitzconsulting.ansible_oracle.oracle_opatch:
7171
oracle_home={{ oracle_home_db }}
7272
patch_base={{ oracle_patch_install }}/{{ db_version }}/{{ item.0.path | default (item.0.patchid) }}/{{ item.1 }}
7373
patch_id={{ item.1 }}
@@ -91,16 +91,16 @@
9191
register: psuapplym
9292

9393
- name: db_opatch | Manage opatchauto patches for DB (gi)
94-
oracle_opatch:
95-
oracle_home={{ oracle_home_db }}
96-
patch_base={{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default (item.patchid) }}/
97-
patch_id={{ item.patchid }}
98-
patch_version={{ item.patchversion | default(omit) }}
99-
opatchauto=True
100-
conflict_check=True
101-
ocm_response_file={{ ocm_response_file | default(omit) }}
102-
output=verbose
103-
state={{ item.state }}
94+
opitzconsulting.ansible_oracle.oracle_opatch:
95+
oracle_home: "{{ oracle_home_db }}"
96+
patch_base: "{{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default(item.patchid) }}/"
97+
patch_id: "{{ item.patchid }}"
98+
patch_version: "{{ item.patchversion | default(omit) }}"
99+
opatchauto: true
100+
conflict_check: true
101+
ocm_response_file: "{{ ocm_response_file | default(omit) }}"
102+
output: verbose
103+
state: "{{ item.state }}"
104104
with_items:
105105
- "{{ db_homes_config[dbh.home]['opatchauto'] }}"
106106
# run_once: "{{ configure_cluster}}"
@@ -111,18 +111,18 @@
111111
register: psuapplym
112112

113113
- name: db_opatch | Manage patches for DB
114-
oracle_opatch:
115-
oracle_home={{ oracle_home_db }}
116-
patch_base={{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default (item.patchid) }}/
117-
patch_id={{ item.patchid }}
118-
patch_version={{ item.patchversion | default(omit) }}
119-
exclude_upi={{ item.excludeUPI | default(omit) }}
120-
opatchauto=False
121-
conflict_check=True
122-
stop_processes={{ item.stop_processes | default(False) }}
123-
ocm_response_file={{ ocm_response_file | default(omit) }}
124-
output=verbose
125-
state={{ item.state }}
114+
opitzconsulting.ansible_oracle.oracle_opatch:
115+
oracle_home: "{{ oracle_home_db }}"
116+
patch_base: "{{ oracle_patch_install }}/{{ db_version }}/{{ item.path | default(item.patchid) }}/"
117+
patch_id: "{{ item.patchid }}"
118+
patch_version: "{{ item.patchversion | default(omit) }}"
119+
exclude_upi: "{{ item.excludeUPI | default(omit) }}"
120+
opatchauto: false
121+
conflict_check: true
122+
stop_processes: "{{ item.stop_processes | default(False) }}"
123+
ocm_response_file: "{{ ocm_response_file | default(omit) }}"
124+
output: verbose
125+
state: "{{ item.state }}"
126126
with_items:
127127
- "{{ db_homes_config[dbh.home]['opatch'] }}"
128128
# run_once: "{{ configure_cluster }}"

roles/oraswdb_manage_patches/tasks/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
- "{{ db_homes_installed }}"
2222
tags:
2323
- directories
24-
when: apply_patches_db and item.apply_patches |default (false)
24+
when:
25+
- apply_patches_db
26+
- item.apply_patches | default(false)
2527

2628
- ansible.builtin.include_tasks: db-home-patch.yml
2729
with_items:

roles/oraswdb_manage_patches/tasks/opatch-upgrade.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: db_opatch | Check current opatch version
3-
oracle_opatch:
3+
opitzconsulting.ansible_oracle.oracle_opatch:
44
oracle_home={{ oracle_home_db }}
55
state=opatchversion
66
register: current_opatch_version
@@ -49,7 +49,7 @@
4949
- oragridpatchunpack
5050

5151
- name: db_opatch | Check current opatch version
52-
oracle_opatch:
52+
opitzconsulting.ansible_oracle.oracle_opatch:
5353
oracle_home={{ oracle_home_db }}
5454
state=opatchversion
5555
register: current_opatch_version

roles/oraswdb_manage_patches/tasks/unpack-files.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
- name: db_opatch | Extract opatchauto patch files to patch base
33
ansible.builtin.unarchive:
4-
src={{ oracle_stage }}/{{ item[0].filename }}
5-
dest={{ oracle_patch_stage }}/{{ db_version }}
6-
creates={{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default (omit) }}
7-
copy=no
4+
src: "{{ oracle_stage }}/{{ item[0].filename }}"
5+
dest: "{{ oracle_patch_stage }}/{{ db_version }}"
6+
creates: "{{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default(omit) }}"
7+
copy: false
88
become: true
99
become_user: "{{ oracle_user }}"
1010
with_nested:
@@ -21,10 +21,10 @@
2121

2222
- name: db_opatch | Extract opatchauto patch files to patch base (from remote location)
2323
ansible.builtin.unarchive:
24-
src={{ oracle_stage_remote }}/{{ item[0].filename }}
25-
dest={{ oracle_patch_stage }}/{{ db_version }}
26-
creates={{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default (omit) }}
27-
copy=no
24+
src: "{{ oracle_stage_remote }}/{{ item[0].filename }}"
25+
dest: "{{ oracle_patch_stage }}/{{ db_version }}"
26+
creates: "{{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default(omit) }}"
27+
copy: false
2828
become: true
2929
become_user: "{{ oracle_user }}"
3030
with_nested:
@@ -43,15 +43,15 @@
4343

4444
- name: db_opatch | Extract one-off patch files to patch base
4545
ansible.builtin.unarchive:
46-
src={{ oracle_stage }}/{{ item[0].filename }}
47-
dest={{ oracle_patch_stage }}/{{ db_version }}
48-
creates={{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default (omit) }}
49-
copy=no
46+
src: "{{ oracle_stage }}/{{ item[0].filename }}"
47+
dest: "{{ oracle_patch_stage }}/{{ db_version }}"
48+
creates: "{{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default(omit) }}"
49+
copy: false
5050
become: true
5151
become_user: "{{ oracle_user }}"
5252
with_nested:
5353
- "{{ oracle_sw_patches }}"
54-
- "{{ db_homes_config[dbh.home]['opatch'] }}"
54+
- "{{ db_homes_config[dbh.home]['opatch'] }}"
5555
when:
5656
- apply_patches_db
5757
- item[1].patchid == item[0].patchid
@@ -64,10 +64,10 @@
6464

6565
- name: db_opatch | Extract one-off patch files to patch base (from remote location)
6666
ansible.builtin.unarchive:
67-
src={{ oracle_stage_remote }}/{{ item[0].filename }}
68-
dest={{ oracle_patch_stage }}/{{ db_version }}
69-
creates={{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default (omit) }}
70-
copy=no
67+
src: "{{ oracle_stage_remote }}/{{ item[0].filename }}"
68+
dest: "{{ oracle_patch_stage }}/{{ db_version }}"
69+
creates: "{{ oracle_patch_stage }}/{{ db_version }}/{{ item[0].creates | default(omit) }}"
70+
copy: false
7171
become: true
7272
become_user: "{{ oracle_user }}"
7373
with_nested:

0 commit comments

Comments
 (0)