From 7957a43dfb56aca345cef04523373b0c4c908f7b Mon Sep 17 00:00:00 2001 From: mongi Date: Wed, 28 May 2025 15:08:26 +0000 Subject: [PATCH] Update deploy_mongo.yml --- deploy_mongo.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/deploy_mongo.yml b/deploy_mongo.yml index b0622bc..a6db58e 100644 --- a/deploy_mongo.yml +++ b/deploy_mongo.yml @@ -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 \ No newline at end of file