diff options
Diffstat (limited to '')
-rw-r--r-- | roles/workspace/tasks/project.yml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/roles/workspace/tasks/project.yml b/roles/workspace/tasks/project.yml new file mode 100644 index 0000000..4a81f78 --- /dev/null +++ b/roles/workspace/tasks/project.yml @@ -0,0 +1,22 @@ +- name: Set project URL + ansible.builtin.set_fact: + project_url: '{{ item.url | default(item) }}' + +- name: Set project name + ansible.builtin.set_fact: + project_name: "{{ item.name | default(project_url | urlsplit('path') | basename | regex_replace('\\.git$', '')) }}" + +- name: 'Update repository: {{ project_name }}' + ansible.builtin.git: + accept_hostkey: true + dest: '{{ workspace_dir }}/{{ project_name }}' + repo: '{{ project_url }}' + +- name: 'Rebuild containers: {{ project_name }}' + become: true + ansible.builtin.shell: + docker-compose pull && + docker-compose build --force-rm --pull -q && + docker-compose up --remove-orphans -d + args: + chdir: '{{ workspace_dir }}/{{ project_name }}' |