1
0
Fork 0

[WHOAMI] Migrate configs

This commit is contained in:
Florian RICHER 2023-05-20 16:06:45 +02:00
parent db6cdfae3b
commit 709466ef51
4 changed files with 38 additions and 1 deletions

View file

@ -5,3 +5,4 @@
roles:
- { role: docker, tags: ["docker"] }
- { role: traefik, tags: ["traefik"] }
- { role: whoami, tags: ["whoami"] }

View file

@ -0,0 +1,32 @@
---
- name: Check whoami directory exist
ansible.builtin.file:
path: whoami
state: directory
- name: Copy template conf
ansible.builtin.template:
backup: true
src: "{{ item.src }}"
dest: "whoami/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
register: whoami_copy_templates_results
- name: Force update and restart container
community.docker.docker_compose:
project_src: whoami
state: present
pull: true
restarted: true
when: whoami_copy_templates_results.changed
become: true
- name: Update or start container
community.docker.docker_compose:
project_src: whoami
state: present
pull: true
when: not whoami_copy_templates_results.changed
become: true

View file

@ -0,0 +1,4 @@
---
- ansible.builtin.import_tasks: base.yml
name: base

View file

@ -10,7 +10,7 @@ services:
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami-secure.entrypoints=https"
- "traefik.http.routers.whoami-secure.rule=Host(`whoami.mrdev023.fr`)"
- "traefik.http.routers.whoami-secure.rule=Host(`whoami.{{ server.domain }}`)"
- "traefik.http.routers.whoami-secure.tls=true"
- "traefik.http.routers.whoami-secure.tls.certresolver=sslResolver"
# - "traefik.http.routers.whoami-secure.service=whoami"