aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-13 14:44:47 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-13 15:05:43 +0200
commit320e1b09d7f63654f7b47474e517ccf417d1470c (patch)
tree25f977a62f876053e3d8cb2a690a2ca689f721e0
parentworkspace: refactoring (diff)
downloadinfra-ansible-320e1b09d7f63654f7b47474e517ccf417d1470c.tar.gz
infra-ansible-320e1b09d7f63654f7b47474e517ccf417d1470c.zip
workspace: run make when available
-rw-r--r--roles/workspace/tasks/project.yml30
1 files changed, 29 insertions, 1 deletions
diff --git a/roles/workspace/tasks/project.yml b/roles/workspace/tasks/project.yml
index 078ceea..89fea0a 100644
--- a/roles/workspace/tasks/project.yml
+++ b/roles/workspace/tasks/project.yml
@@ -16,8 +16,36 @@
dest: '{{ project_dir }}'
repo: '{{ project_url }}'
-- name: 'Rebuild containers: {{ project_name }}'
+- name: Check for Makefile
+ ansible.builtin.file:
+ path: '{{ project_dir }}/Makefile'
+ state: file
+ register: makefile_check
+
+- name: This project uses make
+ become: true
+ when: makefile_check is succeeded
+ block:
+ - name: Run make
+ ansible.builtin.command: make
+ args:
+ chdir: '{{ project_dir }}'
+ register: make_output
+ when: makefile_check is succeeded
+
+ - name: Show make output
+ ansible.builtin.debug:
+ var: make_output
+
+- name: Check for docker-compose.yml
+ ansible.builtin.file:
+ path: '{{ project_dir }}/docker-compose.yml'
+ state: file
+ register: docker_compose_check
+
+- name: This project uses docker-compose
become: true
+ when: makefile_check is not succeeded and docker_compose_check is succeeded
block:
- name: docker-compose pull
ansible.builtin.command: docker-compose pull