Improve oracle-db-postinstall: standardize playbook indentation, add Oracle install check, split git tasks for better idempotency

This commit is contained in:
Yacine31
2025-12-02 12:27:36 +01:00
parent f022b062b7
commit 49abe2e012
2 changed files with 26 additions and 9 deletions

View File

@@ -1,10 +1,8 @@
---
- name: Host configuration
hosts: all
# user: root
# become: yes
become_user: root
become_method: sudo
- name: Host configuration
hosts: all
become_user: root
become_method: sudo
roles:
- oracle-db-postinstall
roles:
- oracle-db-postinstall

View File

@@ -10,6 +10,13 @@
msg: "Prérequis non satisfaits : RAM >= 2GB"
tags: prerequisites
- name: Vérifier que Oracle est installé
ansible.builtin.stat:
path: "{{ oracle_home }}/bin/sqlplus"
register: oracle_installed
failed_when: not oracle_installed.stat.exists
tags: prerequisites
# ---------------------------------------------------
# récupération des scripts sql
# ---------------------------------------------------
@@ -18,7 +25,18 @@
path: "{{ scripts_dir }}"
register: scripts_directory
- name: Git Pull car le répertoire existe
- 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
dest: "{{ scripts_dir }}"
@@ -28,6 +46,7 @@
become: true
become_method: su
become_user: oracle
tags: scripts
- name: Clonage du repository github SQL car le répertoire n'existe pas
ansible.builtin.git: