From 320e1b09d7f63654f7b47474e517ccf417d1470c Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 13 Aug 2023 14:44:47 +0200 Subject: workspace: run make when available --- roles/workspace/tasks/project.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'roles') 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 -- cgit v1.2.3