From a4f981506ff0b27225f95c54205e13ac156f47f2 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Wed, 3 May 2023 22:35:19 +0200 Subject: [PATCH] Add traefik autoconfigure docker --- README.md | 4 ++++ roles/docker/tasks/install.yml | 2 ++ roles/traefik/files/config/traefik.yml | 2 +- roles/traefik/tasks/base.yml | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5b8fdbb..cc1a60f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Configure +```bash +ansible-galaxy collection install community.docker +``` + ```bash ansible-playbook playbook.yml --ask-become-pass ``` \ No newline at end of file diff --git a/roles/docker/tasks/install.yml b/roles/docker/tasks/install.yml index dbc04a7..93463c0 100644 --- a/roles/docker/tasks/install.yml +++ b/roles/docker/tasks/install.yml @@ -25,6 +25,8 @@ - containerd.io - docker-buildx-plugin - docker-compose-plugin + - docker-compose + - python-docker state: latest update_cache: true diff --git a/roles/traefik/files/config/traefik.yml b/roles/traefik/files/config/traefik.yml index 7c3d11c..5b8fa78 100644 --- a/roles/traefik/files/config/traefik.yml +++ b/roles/traefik/files/config/traefik.yml @@ -46,6 +46,6 @@ certificatesResolvers: tlschallenge: {} storage: acme.json keyType: RSA4096 - #caServer: "https://acme-staging-v02.api.letsencrypt.org/directory" + caServer: "https://acme-staging-v02.api.letsencrypt.org/directory" httpChallenge: entryPoint: http diff --git a/roles/traefik/tasks/base.yml b/roles/traefik/tasks/base.yml index c64d8f9..17ff29c 100644 --- a/roles/traefik/tasks/base.yml +++ b/roles/traefik/tasks/base.yml @@ -4,4 +4,17 @@ ansible.builtin.copy: backup: true src: . - dest: traefik/ \ No newline at end of file + dest: traefik/ + +- name: Create proxy network + community.docker.docker_network: + name: proxy + state: present + become: true + +- name: Update or start container + community.docker.docker_compose: + project_src: traefik + state: present + pull: true + become: true \ No newline at end of file