From daca19ddff2a74251964a8366f6ac76f4153905d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 13 Dec 2024 14:39:36 +0100 Subject: my_workspace: add option to only clone the repo --- roles/my_workspace/defaults/main.yml | 2 ++ roles/my_workspace/tasks/project.yml | 53 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/roles/my_workspace/defaults/main.yml b/roles/my_workspace/defaults/main.yml index 2eb04de..2c861e4 100644 --- a/roles/my_workspace/defaults/main.yml +++ b/roles/my_workspace/defaults/main.yml @@ -3,3 +3,5 @@ my_workspace_dir: /srv/workspace my_workspace_projects: [] + +my_workspace_clone_only: false diff --git a/roles/my_workspace/tasks/project.yml b/roles/my_workspace/tasks/project.yml index 790ab74..260950a 100644 --- a/roles/my_workspace/tasks/project.yml +++ b/roles/my_workspace/tasks/project.yml @@ -22,31 +22,34 @@ - name: user.email value: '{{ my_workspace_git_email }}' - - name: Check for Makefile - ansible.builtin.file: - path: '{{ project_dir }}/Makefile' - state: file - register: makefile_check - ignore_errors: true + - name: Set the project running + when: not my_workspace_clone_only + block: + - name: Check for Makefile + ansible.builtin.file: + path: '{{ project_dir }}/Makefile' + state: file + register: makefile_check + ignore_errors: true - - name: Check for docker-compose.yml - ansible.builtin.file: - path: '{{ project_dir }}/docker-compose.yml' - state: file - register: docker_compose_check - ignore_errors: true + - name: Check for docker-compose.yml + ansible.builtin.file: + path: '{{ project_dir }}/docker-compose.yml' + state: file + register: docker_compose_check + ignore_errors: true - - name: Run make - become: true - community.general.make: - chdir: '{{ project_dir }}' - when: makefile_check is succeeded + - name: Run make + become: true + community.general.make: + chdir: '{{ project_dir }}' + when: makefile_check is succeeded - - name: Run docker-compose - become: true - community.docker.docker_compose_v2: - project_src: '{{ project_dir }}' - pull: always - build: always - remove_orphans: true - when: makefile_check is not succeeded and docker_compose_check is succeeded + - name: Run docker-compose + become: true + community.docker.docker_compose_v2: + project_src: '{{ project_dir }}' + pull: always + build: always + remove_orphans: true + when: makefile_check is not succeeded and docker_compose_check is succeeded -- cgit v1.2.3