From 9862863b21558fdf646aebb5578a5d7f963946c0 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 9 Aug 2021 13:53:32 +0300 Subject: add "server" role --- roles/server/tasks/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 roles/server/tasks/main.yml (limited to 'roles/server/tasks') diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml new file mode 100644 index 0000000..05ef180 --- /dev/null +++ b/roles/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 }}' -- cgit v1.2.3