Consolidate redundant git tasks in oracle-db-postinstall role
- Replace 4 separate git tasks with a single consolidated task - Add proper error handling with failed_when condition - Remove ignore_errors usage that was masking real errors
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
---
|
||||||
#
|
#
|
||||||
# post configuration d'une installation de base de données Oracle
|
# post configuration d'une installation de base de données Oracle
|
||||||
#
|
#
|
||||||
@@ -20,46 +21,18 @@
|
|||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
# récupération des scripts sql
|
# récupération des scripts sql
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
- name: Vérifier si le répertoire scripts existe
|
- name: Gérer le repository des scripts SQL
|
||||||
ansible.builtin.stat:
|
ansible.builtin.git:
|
||||||
path: "{{ scripts_dir }}"
|
|
||||||
register: scripts_directory
|
|
||||||
|
|
||||||
- name: Cloner le repo scripts si inexistant
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: https://github.com/Yacine31/sql.git
|
|
||||||
dest: "{{ scripts_dir }}"
|
|
||||||
update: no
|
|
||||||
when: not scripts_directory.stat.exists
|
|
||||||
become: true
|
|
||||||
become_method: su
|
|
||||||
become_user: oracle
|
|
||||||
tags: scripts
|
|
||||||
|
|
||||||
- name: Mettre à jour le repo scripts si existe
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: https://github.com/Yacine31/sql.git
|
repo: https://github.com/Yacine31/sql.git
|
||||||
dest: "{{ scripts_dir }}"
|
dest: "{{ scripts_dir }}"
|
||||||
update: yes
|
update: yes
|
||||||
force: yes
|
force: yes
|
||||||
when: scripts_directory.stat.exists
|
become: true
|
||||||
become: true
|
become_method: su
|
||||||
become_method: su
|
become_user: oracle
|
||||||
become_user: oracle
|
register: git_result
|
||||||
tags: scripts
|
failed_when: git_result.failed and 'already exists' not in git_result.msg
|
||||||
|
tags: scripts
|
||||||
- name: Clonage du repository github SQL car le répertoire n'existe pas
|
|
||||||
ansible.builtin.git:
|
|
||||||
repo: https://github.com/Yacine31/sql.git
|
|
||||||
dest: "{{ scripts_dir }}"
|
|
||||||
clone: yes
|
|
||||||
update: yes
|
|
||||||
force: yes
|
|
||||||
when: not scripts_directory.stat.exists
|
|
||||||
ignore_errors: true
|
|
||||||
become: true
|
|
||||||
become_method: su
|
|
||||||
become_user: oracle
|
|
||||||
|
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
# changement du propriétaire de root en oracle
|
# changement du propriétaire de root en oracle
|
||||||
|
|||||||
Reference in New Issue
Block a user