From 7ee0a52bea7fccc22ce6a2ea5482a2f92a394fe1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 20 Feb 2025 18:44:41 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20playbook=20Ansible=20pour=20le?= =?UTF-8?q?=20d=C3=A9ploiement=20de=20l'application=20front=20via=20Docker?= =?UTF-8?q?=20Compose=20et=20mise=20=C3=A0=20jour=20de=20l'URL=20du=20Keyc?= =?UTF-8?q?loak=20dans=20le=20fichier=20.env.production.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/playbooks/0_front.yml | 51 +++++++++++++++++++++++++++++++++++ front/.env.production | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 ansible/playbooks/0_front.yml diff --git a/ansible/playbooks/0_front.yml b/ansible/playbooks/0_front.yml new file mode 100644 index 0000000..8261ee4 --- /dev/null +++ b/ansible/playbooks/0_front.yml @@ -0,0 +1,51 @@ +--- +- name: Déploiement Docker et application via Docker Compose + hosts: servers + become: true + gather_facts: true + + vars: + git_repo: "https://gite.slm-lab.net/Chabdeltsang/Neah-Enkun.git" + git_dest: "/opt/Neah-Enkun" + git_branch: "master" + front_service_name: "front" + + pre_tasks: + - name: Mise à jour des paquets + apt: + update_cache: true + cache_valid_time: 3600 + upgrade: dist + register: apt_update_status + until: apt_update_status is success + retries: 3 + delay: 5 + + tasks: + - name: Cloner le dépôt Git + git: + repo: "{{ git_repo }}" + dest: "{{ git_dest }}" + version: "{{ git_branch }}" + update: true + force: true + register: git_status + until: git_status is success + retries: 3 + delay: 5 + + - name: Lancer le service Front + command: "docker compose up -d --build --remove-orphans {{ front_service_name }}" + args: + chdir: "{{ git_dest }}" + register: front_status + until: front_status is success + retries: 3 + delay: 5 + changed_when: front_status.rc == 0 + + handlers: + - name: Redémarrer Docker + service: + name: docker + state: restarted diff --git a/front/.env.production b/front/.env.production index 3d95ccf..8a6bc85 100644 --- a/front/.env.production +++ b/front/.env.production @@ -4,4 +4,4 @@ NEXTAUTH_SECRET=9eff5ad2f4b5ea744a34d9d8004cb5236f1931b26bf75f01a0a26203312fe1ec KEYCLOAK_CLIENT_ID=front KEYCLOAK_CLIENT_SECRET=Klsbm7hzyXscypXU0wUPPVBrttFPt6Pn KEYCLOAK_REALM=master -KEYCLOAK_ISSUER=http://connect.neah.local/realms/master \ No newline at end of file +KEYCLOAK_ISSUER=http://172.16.32.141:8090/realms/master \ No newline at end of file