Compare commits
1 Commits
traefik
...
dockerbox_
Author | SHA1 | Date | |
---|---|---|---|
03f0b41ae6 |
@@ -13,7 +13,6 @@ traefik_domain: traefik.vm.krislamo.org
|
|||||||
traefik_auth: admin:$apr1$T1l.BCFz$Jyg8msXYEAUi3LLH39I9d1 # admin:admin
|
traefik_auth: admin:$apr1$T1l.BCFz$Jyg8msXYEAUi3LLH39I9d1 # admin:admin
|
||||||
#traefik_acme_email: realemail@example.com # Let's Encrypt settings
|
#traefik_acme_email: realemail@example.com # Let's Encrypt settings
|
||||||
#traefik_production: true
|
#traefik_production: true
|
||||||
traefik_http_only: true # if behind reverse-proxy
|
|
||||||
|
|
||||||
# nextcloud
|
# nextcloud
|
||||||
nextcloud_version: stable
|
nextcloud_version: stable
|
||||||
|
@@ -1,17 +1,3 @@
|
|||||||
# Copyright (C) 2020 Kris Lamoureux
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Install Docker Box Server
|
- name: Install Docker Box Server
|
||||||
hosts: dockerhosts
|
hosts: dockerhosts
|
||||||
become: true
|
become: true
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
- name: Reboot host
|
- name: Reboot host
|
||||||
reboot:
|
ansible.builtin.reboot:
|
||||||
msg: "Reboot initiated by Ansible"
|
msg: "Reboot initiated by Ansible"
|
||||||
connect_timeout: 5
|
connect_timeout: 5
|
||||||
listen: reboot_host
|
listen: reboot_host
|
||||||
|
@@ -1,18 +1,12 @@
|
|||||||
# Container settings
|
|
||||||
traefik_name: traefik
|
traefik_name: traefik
|
||||||
traefik_standalone: true
|
traefik_dashboard: false
|
||||||
traefik_http_only: false
|
traefik_root: "/opt/{{ traefik_name }}"
|
||||||
traefik_debug: false
|
|
||||||
traefik_web_entry: "80:80"
|
|
||||||
traefik_websecure_entry: "443:443"
|
|
||||||
traefik_localonly: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8"
|
traefik_localonly: "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8"
|
||||||
|
|
||||||
# HTTPS settings
|
|
||||||
traefik_production: false
|
traefik_production: false
|
||||||
traefik_hsts_enable: false
|
traefik_hsts_enable: false
|
||||||
traefik_hsts_preload: false
|
traefik_hsts_preload: false
|
||||||
traefik_hsts_seconds: 0
|
traefik_hsts_seconds: 0
|
||||||
traefik_http_redirect: true
|
traefik_http_redirect: false
|
||||||
|
traefik_ports:
|
||||||
# Host settings
|
- "80:80"
|
||||||
traefik_root: "{{ docker_compose_root }}/{{ traefik_name }}"
|
- "443:443"
|
||||||
|
@@ -4,8 +4,11 @@
|
|||||||
state: touch
|
state: touch
|
||||||
listen: reload_traefik
|
listen: reload_traefik
|
||||||
|
|
||||||
- name: Restart Traefik
|
- name: Restart Traefik container
|
||||||
service:
|
docker_container:
|
||||||
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
name: "{{ traefik_name }}"
|
||||||
state: restarted
|
image: traefik:{{ traefik_version }}
|
||||||
|
state: started
|
||||||
|
container_default_behavior: "no_defaults"
|
||||||
|
restart: yes
|
||||||
listen: restart_traefik
|
listen: restart_traefik
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
- name: Create Traefik directories
|
- name: Create Traefik configuration directories
|
||||||
file:
|
file:
|
||||||
path: "{{ traefik_root }}/config/dynamic"
|
path: "{{ traefik_root }}/config/dynamic"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
|
- name: Install static Traefik configuration
|
||||||
|
template:
|
||||||
|
src: traefik.yml.j2
|
||||||
|
dest: "{{ traefik_root }}/config/traefik.yml"
|
||||||
|
notify: restart_traefik
|
||||||
|
|
||||||
- name: Install dynamic security configuration
|
- name: Install dynamic security configuration
|
||||||
template:
|
template:
|
||||||
src: security.yml.j2
|
src: security.yml.j2
|
||||||
@@ -19,26 +25,32 @@
|
|||||||
loop: "{{ traefik_external }}"
|
loop: "{{ traefik_external }}"
|
||||||
when: traefik_external is defined
|
when: traefik_external is defined
|
||||||
|
|
||||||
- name: Install Traefik's docker-compose file
|
- name: Create Traefik network
|
||||||
template:
|
docker_network:
|
||||||
src: docker-compose.yml.j2
|
name: traefik
|
||||||
dest: "{{ traefik_root }}/docker-compose.yml"
|
|
||||||
notify: restart_traefik
|
|
||||||
|
|
||||||
- name: Install Traefik's docker-compose variables
|
- name: Start Traefik container
|
||||||
template:
|
docker_container:
|
||||||
src: compose-env.j2
|
name: "{{ traefik_name }}"
|
||||||
dest: "{{ traefik_root }}/.env"
|
image: traefik:{{ traefik_version }}
|
||||||
notify: restart_traefik
|
|
||||||
|
|
||||||
- name: Install static Traefik configuration
|
|
||||||
template:
|
|
||||||
src: traefik.yml.j2
|
|
||||||
dest: "{{ traefik_root }}/config/traefik.yml"
|
|
||||||
notify: restart_traefik
|
|
||||||
|
|
||||||
- name: Start and enable Traefik service
|
|
||||||
service:
|
|
||||||
name: "{{ docker_compose_service }}@{{ traefik_name }}"
|
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
restart_policy: always
|
||||||
|
ports: "{{ traefik_ports }}"
|
||||||
|
container_default_behavior: "no_defaults"
|
||||||
|
networks_cli_compatible: "false"
|
||||||
|
networks:
|
||||||
|
- name: traefik
|
||||||
|
labels:
|
||||||
|
traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)"
|
||||||
|
#traefik.http.middlewares.auth.basicauth.users: "{{ traefik_auth }}"
|
||||||
|
#traefik.http.middlewares.localonly.ipwhitelist.sourcerange: "{{ traefik_localonly }}"
|
||||||
|
#traefik.http.routers.traefik.tls.certresolver: letsencrypt
|
||||||
|
#traefik.http.routers.traefik.middlewares: "securehttps@file,auth@docker,localonly"
|
||||||
|
traefik.http.routers.traefik.service: "api@internal"
|
||||||
|
traefik.http.routers.traefik.entrypoints: websecure
|
||||||
|
traefik.http.routers.traefik.tls: "true"
|
||||||
|
traefik.docker.network: traefik
|
||||||
|
traefik.enable: "{{ traefik_dashboard | string }}"
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- "{{ traefik_root }}/config:/etc/traefik"
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
# {{ ansible_managed }}
|
|
||||||
traefik_version={{ traefik_version }}
|
|
||||||
traefik_name={{ traefik_name }}
|
|
||||||
traefik_domain={{ traefik_domain }}
|
|
||||||
traefik_dashboard={{ traefik_dashboard | string | lower }}
|
|
||||||
traefik_debug={{ traefik_debug | string | lower }}
|
|
||||||
traefik_web_entry={{ traefik_web_entry }}
|
|
||||||
traefik_websecure_entry={{ traefik_websecure_entry }}
|
|
@@ -1,25 +0,0 @@
|
|||||||
version: '3.7'
|
|
||||||
|
|
||||||
networks:
|
|
||||||
traefik:
|
|
||||||
name: traefik
|
|
||||||
|
|
||||||
services:
|
|
||||||
traefik:
|
|
||||||
image: "traefik:${traefik_version}"
|
|
||||||
container_name: "${traefik_name}"
|
|
||||||
ports:
|
|
||||||
- "${traefik_web_entry:-80:80}"
|
|
||||||
{% if traefik_standalone and not traefik_http_only %}
|
|
||||||
- "${traefik_websecure_entry:-443:443}"
|
|
||||||
{% endif %}
|
|
||||||
networks:
|
|
||||||
- traefik
|
|
||||||
labels:
|
|
||||||
- "traefik.http.routers.traefik.rule=Host(`{{ traefik_domain }}`)"
|
|
||||||
- "traefik.http.routers.traefik.service=api@internal"
|
|
||||||
- "traefik.docker.network=traefik"
|
|
||||||
- "traefik.enable=${traefik_dashboard:-false}"
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- "{{ traefik_root }}/config:/etc/traefik"
|
|
@@ -10,7 +10,7 @@ providers:
|
|||||||
entrypoints:
|
entrypoints:
|
||||||
web:
|
web:
|
||||||
address: ':80'
|
address: ':80'
|
||||||
{% if traefik_http_redirect is defined and traefik_http_redirect and not traefik_http_only %}
|
{% if traefik_http_redirect is defined and traefik_http_redirect %}
|
||||||
http:
|
http:
|
||||||
redirections:
|
redirections:
|
||||||
entrypoint:
|
entrypoint:
|
||||||
@@ -18,12 +18,10 @@ entrypoints:
|
|||||||
scheme: https
|
scheme: https
|
||||||
permanent: true
|
permanent: true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not traefik_http_only is defined or not traefik_http_only %}
|
|
||||||
websecure:
|
websecure:
|
||||||
address: ':443'
|
address: ':443'
|
||||||
http:
|
http:
|
||||||
tls: {}
|
tls: {}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if traefik_acme_email is defined %}
|
{% if traefik_acme_email is defined %}
|
||||||
certificatesResolvers:
|
certificatesResolvers:
|
||||||
|
Reference in New Issue
Block a user