[WHOAMI] Migrate configs
This commit is contained in:
parent
db6cdfae3b
commit
709466ef51
4 changed files with 38 additions and 1 deletions
|
@ -5,3 +5,4 @@
|
|||
roles:
|
||||
- { role: docker, tags: ["docker"] }
|
||||
- { role: traefik, tags: ["traefik"] }
|
||||
- { role: whoami, tags: ["whoami"] }
|
||||
|
|
32
roles/whoami/tasks/base.yml
Normal file
32
roles/whoami/tasks/base.yml
Normal 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
|
4
roles/whoami/tasks/main.yml
Normal file
4
roles/whoami/tasks/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
|
||||
- ansible.builtin.import_tasks: base.yml
|
||||
name: base
|
|
@ -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"
|
Loading…
Reference in a new issue