From 0f8c30a6c16c9023562a15b395945333cc1822cf Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 26 Oct 2021 21:59:00 +0200 Subject: [PATCH] add a docker-compose task --- tasks/main.yml | 11 +++++++++-- vars/main.yml | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 6413b45..5f657d6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -35,11 +35,18 @@ - name: "Copy the project files to the server" copy: src: "{{ docker_project_name }}" - dest: "{{ lookup('env', 'HOME') }}/" + dest: "{{ docker_project_path }}/" become: false - name: "Copy the traefik config" copy: src: "traefik.yaml" - dest: "{{ lookup('env', 'HOME') }}/{{ docker_project_name }}/traefik.yaml" + dest: "{{ docker_project_path }}/traefik.yaml" become: false + +- name: "Start the Docker containers" + community.docker.docker_compose: + project_src: "{{ docker_project_path }}" + state: "present" + pull: "yes" + remove_orphans: "yes" diff --git a/vars/main.yml b/vars/main.yml index 70c2b66..1fce86f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1 +1,2 @@ docker_lazydocker_version: 0.12 +docker_project_path: "{{ lookup('env', 'HOME') }}/{{ docker_project_name }}"