Update deploy_mongo.yml

This commit is contained in:
mongi 2025-05-28 15:08:26 +00:00
parent 50db3d48e4
commit 7957a43dfb

View File

@ -36,16 +36,15 @@
path: "{{ repo_clone_dest }}"
state: directory
mode: '0755'
recurse: yes # Create parent directories if they don't exist
recurse: yes
tags: setup
- name: Clone or update the Git repository
ansible.builtin.git:
repo: "{{ repo_url }}"
dest: "{{ repo_clone_dest }}"
version: main # Specify the branch, tag, or commit hash (e.g., 'develop', 'v1.0.0', 'abcdef123')
force: yes # Useful for re-running; ensures the dest is exactly what's in the repo
# (pulls changes, or even re-clones if the dest is messy).
version: main
force: yes
register: git_clone_result
tags: git
@ -66,22 +65,23 @@
when: not role_dir_stat.stat.exists or not role_dir_stat.stat.isdir
tags: validation
- name: Add the cloned role path to roles_path
set_fact:
ansible_roles_path: "{{ role_absolute_path }}"
tags: run_role
- name: Run the specified Ansible role from the cloned repository
# Cette ligne est indentée de 6 espaces devant 'ansible.builtin.include_role:' (4 + 2).
ansible.builtin.include_role:
# Ces lignes sont indentées de 8 espaces devant 'name:' et '_path:' (6 + 2).
name: "{{ role_name }}"
_path: "{{ role_absolute_path }}"
# You can pass variables specific to the role here if needed:
# vars:
# nginx_port: 8080
# app_env: "production"
vars:
# Ajoute ici les variables spécifiques à ton rôle si besoin
# nginx_port: 8080
# app_env: "production"
tags: run_role
- name: Clean up the cloned repository (optional)
ansible.builtin.file:
path: "{{ repo_clone_dest }}"
state: absent
when: ansible_cleanup_repo | default(false) | bool # Only run if ansible_cleanup_repo is true
tags: cleanup
when: ansible_cleanup_repo | default(false) | bool
tags: cleanup