aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-12 19:02:56 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-12 19:07:03 +0200
commitd68b5830caef9e243019651186136c5c1eb7f874 (patch)
tree4cf74176eb029a505218a545e359f7fb8af21577
parentapt: unattended upgrades are optional (diff)
downloadinfra-ansible-d68b5830caef9e243019651186136c5c1eb7f874.tar.gz
infra-ansible-d68b5830caef9e243019651186136c5c1eb7f874.zip
workspace: refactoring
-rw-r--r--roles/workspace/tasks/project.yml27
1 files changed, 20 insertions, 7 deletions
diff --git a/roles/workspace/tasks/project.yml b/roles/workspace/tasks/project.yml
index 4a81f78..078ceea 100644
--- a/roles/workspace/tasks/project.yml
+++ b/roles/workspace/tasks/project.yml
@@ -6,17 +6,30 @@
ansible.builtin.set_fact:
project_name: "{{ item.name | default(project_url | urlsplit('path') | basename | regex_replace('\\.git$', '')) }}"
+- name: Set project directory
+ ansible.builtin.set_fact:
+ project_dir: '{{ workspace_dir }}/{{ project_name }}'
+
- name: 'Update repository: {{ project_name }}'
ansible.builtin.git:
accept_hostkey: true
- dest: '{{ workspace_dir }}/{{ project_name }}'
+ dest: '{{ project_dir }}'
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 }}'
+ block:
+ - name: docker-compose pull
+ ansible.builtin.command: docker-compose pull
+ args:
+ chdir: '{{ project_dir }}'
+
+ - name: docker-compose build
+ ansible.builtin.command: docker-compose build --force-rm --pull -q
+ args:
+ chdir: '{{ project_dir }}'
+
+ - name: docker-compose up
+ ansible.builtin.command: docker-compose up --remove-orphans -d
+ args:
+ chdir: '{{ project_dir }}'