|
1 | 1 | --- |
| 2 | +# dbbp apply steps for RAC cluster |
| 3 | + |
| 4 | +- name: DBBP RAC | get list of database names on host |
| 5 | + shell: srvctl config database | sed 's/$/:/' |
| 6 | + become_user: "{{ oracle_user }}" |
| 7 | + environment: "{{ env }}" |
| 8 | + register: all_databases |
| 9 | + tags: catbundle |
| 10 | + |
| 11 | +- debug: var=all_databases.stdout_lines |
| 12 | + |
| 13 | +- name: DBBP SI | Get list of databases running in 'oracle_home' |
| 14 | + shell: cat /etc/oratab | grep '{{ all_databases.stdout_lines | join('\|') }}' | grep {{ oracle_home }} | egrep ':N|:Y'|grep -v \*|cut -f1 -d':' |
| 15 | + register: dblist |
| 16 | + tags: datapatch |
| 17 | + |
| 18 | +- debug: var=dblist |
| 19 | + |
| 20 | +- name: DBBP RAC | Generate srvctl state file |
| 21 | + template: |
| 22 | + src: srvctl_state.j2 |
| 23 | + dest: "{{ oracle_home }}/srvm/admin/psu_state.txt" |
| 24 | + owner: "{{ oracle_user }}" |
| 25 | + group: "{{ oracle_group }}" |
| 26 | + |
| 27 | +- name: DBBP RAC | delete srvctl state file if it exists |
| 28 | + file: path={{ oracle_home }}/srvm/admin/oneoffstop.txt state=absent |
| 29 | + |
| 30 | +- name: DBBP RAC | Update opatch |
| 31 | + unarchive: |
| 32 | + src: "{{ oracle_stage_install }}/{{ opatch[oracle_version].filename }}" |
| 33 | + dest: "{{ item }}" |
| 34 | + copy: no |
| 35 | + owner: "{{ oracle_user }}" |
| 36 | + group: "{{ oracle_group }}" |
| 37 | + with_items: |
| 38 | + - "{{ oracle_home }}" |
| 39 | + - "{{ grid_home|default(omit) }}" |
| 40 | + |
| 41 | +- name: DBBP RAC | Opatch lsinventory |
| 42 | + shell: "{{ item }}/OPatch/opatch lsinventory -oh {{ item }}" |
| 43 | + become_user: "{{ oracle_user }}" |
| 44 | + with_items: |
| 45 | + - "{{ oracle_home }}" |
| 46 | + - "{{ grid_home|default(omit) }}" |
| 47 | + register: lsinv_pre |
| 48 | + |
| 49 | +- debug: var=lsinv_pre.results |
| 50 | + |
| 51 | +- name: DBBP RAC | Get list of patches in DBBP |
| 52 | + find: |
| 53 | + path: "{{ patch_directory }}/{{ quarterly_patches[patch_type][oracle_version][patch_name].patchid }}" |
| 54 | + file_type: directory |
| 55 | + patterns: '^\d{8}' |
| 56 | + use_regex: true |
| 57 | + register: dbbp_patches |
| 58 | + |
| 59 | +- name: DBBP RAC | Template patch list |
| 60 | + template: |
| 61 | + src: dbbp_patch_list.j2 |
| 62 | + dest: "{{ oracle_stage_base }}/dbbp_patch_list_{{ oracle_version }}_{{ patch_name }}.txt" |
| 63 | + owner: "{{ oracle_user }}" |
| 64 | + group: "{{ oracle_group }}" |
| 65 | + |
| 66 | +- name: DBBP RAC | check for conflicts (oracle_home) |
| 67 | + shell: "{{ oracle_home }}/OPatch/opatch prereq {{ item }} -phBaseFile {{ oracle_stage_base }}/dbbp_patch_list_{{ oracle_version }}_{{ patch_name }}.txt" |
| 68 | + environment: "{{ env }}" |
| 69 | + register: opatch_conflicts |
| 70 | + with_items: |
| 71 | + - CheckConflictAgainstOHWithDetail |
| 72 | + - CheckSystemSpace |
| 73 | + |
| 74 | +- name: DBBP RAC | check for conflicts (grid_home) |
| 75 | + shell: "{{ grid_home }}/OPatch/opatch prereq {{ item }} -phBaseFile {{ oracle_stage_base }}/dbbp_patch_list_{{ oracle_version }}_{{ patch_name }}.txt" |
| 76 | + environment: "{{ env }}" |
| 77 | + register: opatch_conflicts |
| 78 | + with_items: |
| 79 | + - CheckConflictAgainstOHWithDetail |
| 80 | + - CheckSystemSpace |
| 81 | + |
| 82 | +- name: RAC | Apply patch to first node |
| 83 | + shell: "{{ grid_home }}/OPatch/opatchauto apply {{ patch_directory }}/{{ quarterly_patches[patch_type][oracle_version][patch_name].patchid }}" |
| 84 | + become_user: root |
| 85 | + when: master_node |
| 86 | + |
| 87 | +- name: RAC | Shutdown Oracle Home on first node |
| 88 | + shell: srvctl stop home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }} -f |
| 89 | + become_user: "{{ oracle_user }}" |
| 90 | + environment: "{{ env }}" |
| 91 | + when: master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 92 | + |
| 93 | +- name: RAC | Apply One Off Patches to First node |
| 94 | + include: oneoff_apply.yml |
| 95 | + when: master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 96 | + |
| 97 | +- name: RAC | Startup Oracle Home on first node |
| 98 | + shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }} |
| 99 | + become_user: "{{ oracle_user }}" |
| 100 | + environment: "{{ env }}" |
| 101 | + when: master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 102 | + |
| 103 | +- name: RAC | Check if stuff is running |
| 104 | + shell: "{{ grid_home }}/bin/crsctl stat res -t" |
| 105 | + become_user: "{{ oracle_user }}" |
| 106 | + when: master_node |
| 107 | + register: stat_res_t |
| 108 | + |
| 109 | +- debug: var=stat_res_t.stdout_lines |
| 110 | + |
| 111 | +- name: RAC | Pause after first node |
| 112 | + pause: prompt="Verify everything's running on the first node." |
| 113 | + |
| 114 | +- name: RAC | Apply patch to second node |
| 115 | + shell: "{{ grid_home }}/OPatch/opatchauto apply {{ patch_directory }}/{{ quarterly_patches[patch_type][oracle_version][patch_name].patchid }}" |
| 116 | + become_user: root |
| 117 | + when: not master_node |
| 118 | + |
| 119 | +- name: RAC | Shutdown Oracle Home on second node |
| 120 | + shell: srvctl stop home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }} -f |
| 121 | + become_user: "{{ oracle_user }}" |
| 122 | + environment: "{{ env }}" |
| 123 | + when: not master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 124 | + |
| 125 | +- name: RAC | Apply One Off Patches to second node |
| 126 | + include: oneoff_apply.yml |
| 127 | + when: not master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 128 | + |
| 129 | +- name: RAC | Startup Oracle Home on second node |
| 130 | + shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }} |
| 131 | + become_user: "{{ oracle_user }}" |
| 132 | + environment: "{{ env }}" |
| 133 | + when: not master_node and oneoff_patches[ quarterly_patches[patch_type][oracle_version][patch_name].patchversion ] is defined |
| 134 | + |
| 135 | +- name: RAC | Run Catbundle Script |
| 136 | + include: run_catbundle.yml |
| 137 | + run_once: true |
| 138 | + |
| 139 | +- name: RAC | Opatch lsinventory |
| 140 | + shell: "{{ item }}/OPatch/opatch lsinventory -oh {{ item }}" |
| 141 | + become_user: "{{ oracle_user }}" |
| 142 | + with_items: |
| 143 | + - "{{ oracle_home }}" |
| 144 | + - "{{ grid_home|default(omit) }}" |
| 145 | + register: lsinv_post |
| 146 | + |
| 147 | +- debug: var=lsinv_post.results |
0 commit comments