aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/my_server/tasks/main.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-03-17 09:47:04 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-03-17 09:47:04 +0300
commitaa62fec98a433cead0a6d706ba599af99bc05ad7 (patch)
treef6db894666e35e70d63741db3fbc97cd8caa43fc /roles/my_server/tasks/main.yml
parentworkflows/ci: install newer collections (diff)
downloadmaintenance-aa62fec98a433cead0a6d706ba599af99bc05ad7.tar.gz
maintenance-aa62fec98a433cead0a6d706ba599af99bc05ad7.zip
roles: my-server -> my_server
Diffstat (limited to 'roles/my_server/tasks/main.yml')
-rw-r--r--roles/my_server/tasks/main.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/my_server/tasks/main.yml b/roles/my_server/tasks/main.yml
new file mode 100644
index 0000000..05ef180
--- /dev/null
+++ b/roles/my_server/tasks/main.yml
@@ -0,0 +1,23 @@
+- name: 'Check if {{ server_dir }}/docker-compose.yml exists'
+ stat:
+ path: '{{ server_dir }}/docker-compose.yml'
+ register: server_exists
+
+- when: server_exists.stat.exists
+ become: true
+ block:
+ # community.docker.docker_compose is too confusing for me to use, sorry.
+ - name: docker-compose pull
+ command: docker-compose pull --quiet
+ args:
+ chdir: '{{ server_dir }}'
+
+ - name: docker-compose build
+ command: docker-compose build --pull
+ args:
+ chdir: '{{ server_dir }}'
+
+ - name: docker-compose up
+ command: docker-compose up -d
+ args:
+ chdir: '{{ server_dir }}'