aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/workspace/tasks/project.yml
blob: 4a81f78a81dc532baf9adece32549569e3399a0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 }}'