Improve oracle-db-postinstall: standardize playbook indentation, add Oracle install check, split git tasks for better idempotency
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Host configuration
|
- name: Host configuration
|
||||||
hosts: all
|
hosts: all
|
||||||
# user: root
|
become_user: root
|
||||||
# become: yes
|
become_method: sudo
|
||||||
become_user: root
|
|
||||||
become_method: sudo
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- oracle-db-postinstall
|
- oracle-db-postinstall
|
||||||
|
|||||||
@@ -10,6 +10,13 @@
|
|||||||
msg: "Prérequis non satisfaits : RAM >= 2GB"
|
msg: "Prérequis non satisfaits : RAM >= 2GB"
|
||||||
tags: prerequisites
|
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
|
# récupération des scripts sql
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@@ -18,7 +25,18 @@
|
|||||||
path: "{{ scripts_dir }}"
|
path: "{{ scripts_dir }}"
|
||||||
register: scripts_directory
|
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:
|
ansible.builtin.git:
|
||||||
repo: https://github.com/Yacine31/sql.git
|
repo: https://github.com/Yacine31/sql.git
|
||||||
dest: "{{ scripts_dir }}"
|
dest: "{{ scripts_dir }}"
|
||||||
@@ -28,6 +46,7 @@
|
|||||||
become: true
|
become: true
|
||||||
become_method: su
|
become_method: su
|
||||||
become_user: oracle
|
become_user: oracle
|
||||||
|
tags: scripts
|
||||||
|
|
||||||
- name: Clonage du repository github SQL car le répertoire n'existe pas
|
- name: Clonage du repository github SQL car le répertoire n'existe pas
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
|
|||||||
Reference in New Issue
Block a user