Modernize Ansible playbooks: replace deprecated syntax (include: -> include_tasks:, with_items -> loop), use ansible.builtin modules, organize variables (defaults/main.yml), standardize tags, add prerequisites assertions and meta/main.yml
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
---
|
||||
- name: Vérification de l'espace disque u01
|
||||
action: shell df -P /u01 | awk 'END { print $4 }'
|
||||
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
|
||||
action: shell df -P /tmp | awk 'END { print $4 }'
|
||||
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
|
||||
unarchive: src={{ patch_dir }}/{{ opatch_file }} dest={{ oracle_home }}
|
||||
# action: shell unzip -oq {{ patch_dir }}/{{ opatch_file }} -d {{ 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
|
||||
unarchive: src={{ patch_dir }}/{{ psu_file }} dest={{ patch_dir }}
|
||||
# action: shell unzip -oq {{ patch_dir }}/{{ psu_file }} -d {{ patch_dir }}
|
||||
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
|
||||
action: shell export ORACLE_HOME={{ oracle_home }}; cd {{ patch_dir }}/{{ patch_number }}; $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
|
||||
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
|
||||
@@ -37,7 +37,7 @@
|
||||
tags: patch_db
|
||||
|
||||
- name: Application du patch
|
||||
action: shell export ORACLE_HOME={{ oracle_home}}; cd {{ patch_dir }}/{{ patch_number }}; $ORACLE_HOME/OPatch/opatch apply -silent
|
||||
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
|
||||
@@ -46,26 +46,26 @@
|
||||
tags: patch_db
|
||||
|
||||
- name: Résultat de l'installation via OPatch
|
||||
shell: "{{ oracle_home }}/OPatch/opatch lspatches"
|
||||
ansible.builtin.shell: "{{ oracle_home }}/OPatch/opatch lspatches"
|
||||
become: true
|
||||
become_method: su
|
||||
become_user: oracle
|
||||
register: opatchls
|
||||
tags: patch_db
|
||||
|
||||
- debug: var=opatchls.stdout_lines
|
||||
- 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
|
||||
file: path={{ oracle_sources }}/{{ patch_number }} state=absent
|
||||
ansible.builtin.file: path={{ oracle_sources }}/{{ patch_number }} state=absent
|
||||
tags: patch_db
|
||||
|
||||
- name: suppression du fichier OPatch
|
||||
file: path={{ oracle_sources }}/{{ opatch_file }} state=absent
|
||||
ansible.builtin.file: path={{ oracle_sources }}/{{ opatch_file }} state=absent
|
||||
tags: patch_db
|
||||
|
||||
- name: suppression du Patch RU
|
||||
file: path={{ oracle_sources }}/{{ psu_file }} state=absent
|
||||
ansible.builtin.file: path={{ oracle_sources }}/{{ psu_file }} state=absent
|
||||
tags: patch_db
|
||||
Reference in New Issue
Block a user