aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/workspace/tasks/project.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-04 11:52:07 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-04 12:05:50 +0200
commit5cf47ce64eff1da4086e41782bb6bfb67a001b7d (patch)
tree5cbdf0bdf9aabaf2c64c3a95d3f1eda4fd53ae74 /roles/workspace/tasks/project.yml
parentimport some common roles (diff)
downloadinfra-ansible-5cf47ce64eff1da4086e41782bb6bfb67a001b7d.tar.gz
infra-ansible-5cf47ce64eff1da4086e41782bb6bfb67a001b7d.zip
import workspace role
Diffstat (limited to 'roles/workspace/tasks/project.yml')
-rw-r--r--roles/workspace/tasks/project.yml22
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 }}'