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