diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 83c8dd6..83d17a3 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -14,6 +14,9 @@ server: port: 22 peers: test +private_network: + extra_ips_whitelist: [] + acme: email: test@test.fr debug: true diff --git a/roles/traefik/tasks/base.yml b/roles/traefik/tasks/base.yml index 07940a8..1cf2e85 100644 --- a/roles/traefik/tasks/base.yml +++ b/roles/traefik/tasks/base.yml @@ -12,9 +12,14 @@ loop: - { src: 'docker-compose.yml', dest: 'docker-compose.yml' } - { src: 'config/traefik.yml', dest: 'config/traefik.yml' } - - { src: 'config/dynamic_conf.yml', dest: 'config/dynamic_conf.yml' } register: traefik_copy_templates_results +# Avoid restart docker if dynamic_conf updated +- name: Copy dynamic_conf conf + ansible.builtin.template: + src: "config/dynamic_conf.yml" + dest: "traefik/config/dynamic_conf.yml" + - name: Update and restart container community.docker.docker_compose: project_src: traefik diff --git a/roles/traefik/templates/config/dynamic_conf.yml b/roles/traefik/templates/config/dynamic_conf.yml index 01d209b..63e6f35 100644 --- a/roles/traefik/templates/config/dynamic_conf.yml +++ b/roles/traefik/templates/config/dynamic_conf.yml @@ -4,6 +4,10 @@ http: ipWhiteList: sourceRange: - "{{ server.vpn.subnet }}" + - "{{ server.ip }}" +{% for ip in private_network.extra_ips_whitelist %} + - "{{ ip }}" +{% endfor %} routers: octoPrint-secure: entryPoints: