aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2024-12-13 14:39:36 +0100
committerEgor Tensin <egor@tensin.name>2024-12-13 14:39:36 +0100
commitdaca19ddff2a74251964a8366f6ac76f4153905d (patch)
tree6a8eb060c050fcb5dbeaf6608e8a6c5fd6e0ed52
parentv4.0.1 (diff)
downloadinfra-ansible-daca19ddff2a74251964a8366f6ac76f4153905d.tar.gz
infra-ansible-daca19ddff2a74251964a8366f6ac76f4153905d.zip
my_workspace: add option to only clone the repo
-rw-r--r--roles/my_workspace/defaults/main.yml2
-rw-r--r--roles/my_workspace/tasks/project.yml53
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