Files
oracle_19_install/roles/oracle-db-install/tasks/opatch_apply.yml

71 lines
2.6 KiB
YAML

---
- name: Vérification de l'espace disque u01
ansible.builtin.shell: df -P /u01 | awk 'END { print $4 }'
register: u01size
failed_when: u01size.stdout|int < {{ u01_size_gb }} * 1024 * 1024
tags: patch_db
- name: Vérification de l'espace disque tmp
ansible.builtin.shell: df -P /tmp | awk 'END { print $4 }'
register: tmpsize
failed_when: tmpsize.stdout|int < {{ tmp_size_gb }} * 1024 * 1024
tags: patch_db
- name: Installation OPatch dns ORACLE_HOME
ansible.builtin.unarchive: src={{ patch_dir }}/{{ opatch_file }} dest={{ oracle_home }}
# ansible.builtin.shell: unzip -oq {{ patch_dir }}/{{ opatch_file }} -d {{ oracle_home }}
become: true
become_method: su
become_user: oracle
tags: patch_db
- name: unzip du patch
ansible.builtin.unarchive: src={{ patch_dir }}/{{ psu_file }} dest={{ patch_dir }}
# ansible.builtin.shell: unzip -oq {{ patch_dir }}/{{ psu_file }} -d {{ patch_dir }}
become: true
become_method: su
become_user: oracle
tags: patch_db
- name: patch conflict detection
ansible.builtin.shell: export ORACLE_HOME={{ oracle_home }}; cd {{ patch_dir }}/{{ patch_number }}; $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
register: conflict_detection
failed_when: "'Prereq \"checkConflictAgainstOHWithDetail\" passed.' not in conflict_detection.stdout"
become: true
become_method: su
become_user: oracle
tags: patch_db
- name: Application du patch
ansible.builtin.shell: export ORACLE_HOME={{ oracle_home}}; cd {{ patch_dir }}/{{ patch_number }}; $ORACLE_HOME/OPatch/opatch apply -silent
register: apply_psu
failed_when: "'OPatch succeeded.' not in apply_psu.stdout"
become: true
become_method: su
become_user: oracle
tags: patch_db
- name: Résultat de l'installation via OPatch
ansible.builtin.shell: "{{ oracle_home }}/OPatch/opatch lspatches"
become: true
become_method: su
become_user: oracle
register: opatchls
tags: patch_db
- ansible.builtin.debug: var=opatchls.stdout_lines
# with_items: opatchls.results
tags: patch_db
# suppression des binaires, du fichier de réponse et du script d'install
- name: Nettoyage du répertoire du patch
ansible.builtin.file: path={{ oracle_sources }}/{{ patch_number }} state=absent
tags: patch_db
- name: suppression du fichier OPatch
ansible.builtin.file: path={{ oracle_sources }}/{{ opatch_file }} state=absent
tags: patch_db
- name: suppression du Patch RU
ansible.builtin.file: path={{ oracle_sources }}/{{ psu_file }} state=absent
tags: patch_db