Migrate services part
This commit is contained in:
parent
7c59e4ae57
commit
73bce8f6e5
157 changed files with 3883 additions and 9 deletions
playbooks/templates
43
playbooks/templates/caddy_site.conf.j2
Normal file
43
playbooks/templates/caddy_site.conf.j2
Normal file
|
@ -0,0 +1,43 @@
|
|||
{%- macro caddy_site_hsts(svc, for_www) -%}
|
||||
{%- if svc.hsts|default(false) and (svc.www_domain|default(false) == for_www) -%}
|
||||
{{ 'header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"' if svc.hsts|default(false) }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro caddy_site(svc) %}
|
||||
{%- for domain in svc.additional_domains|default([]) %}
|
||||
{{ domain }},
|
||||
{% endfor -%}
|
||||
{{ "www." + svc.domain if svc.www_domain|default(false) else svc.domain }} {
|
||||
import default
|
||||
{{ caddy_site_hsts(svc, false) }}
|
||||
|
||||
{{ svc.caddy_extra | indent(width='\t', first=True) if svc.caddy_extra|default(false) }}
|
||||
|
||||
{% if svc.caddy_default|default(true) %}
|
||||
handle {
|
||||
{% if svc.faas_function|default(false) %}
|
||||
import faas {{ svc.faas_function }}
|
||||
{% elif svc.redirect|default(false) %}
|
||||
redir "{{ svc.redirect }}"
|
||||
{% else %}
|
||||
reverse_proxy {{ svc.docker_host|default(svc.name) }}:{{ svc.port }}
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if svc.www_domain|default(false) %}
|
||||
{{ svc.domain }} {
|
||||
import default
|
||||
{{ caddy_site_hsts(svc, true) }}
|
||||
redir https://www.{{ svc.domain }}{uri}
|
||||
}
|
||||
{% endif %}
|
||||
{% endmacro -%}
|
||||
|
||||
{{ caddy_site(svc) }}
|
||||
|
||||
{%- for extra_svc in svc.extra_svcs|default([]) %}
|
||||
{{ caddy_site(extra_svc) }}
|
||||
{% endfor %}
|
20
playbooks/templates/docker-compose.yml.j2
Normal file
20
playbooks/templates/docker-compose.yml.j2
Normal file
|
@ -0,0 +1,20 @@
|
|||
{%- set compose_file = compose.file | default({}) -%}
|
||||
{%- set compose_file = compose_file_main | combine(compose_file, recursive=True) -%}
|
||||
|
||||
{%- if env is defined -%}
|
||||
{%- set compose_file = compose_file | combine(compose_file_env, recursive=True) -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if compose.network | default(True) -%}
|
||||
{%- set compose_file = compose_file | combine(compose_file_networks, recursive=True) -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if compose.volumes | default(False) -%}
|
||||
{%- set compose_file = compose_file | combine(compose_file_volumes, recursive=True) -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if compose.monitoring | default(False) -%}
|
||||
{%- set compose_file = compose_file | combine(compose_file_monitoring_label, recursive=True) -%}
|
||||
{%- endif -%}
|
||||
|
||||
{{ compose_file | to_nice_yaml }}
|
7
playbooks/templates/env.j2
Normal file
7
playbooks/templates/env.j2
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% for key, value in env.items() %}
|
||||
{% if value is boolean %}
|
||||
{{ key }}={{ value|lower }}
|
||||
{% else %}
|
||||
{{ key }}={{ value }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
1
playbooks/templates/json.j2
Normal file
1
playbooks/templates/json.j2
Normal file
|
@ -0,0 +1 @@
|
|||
{{ json | to_json }}
|
1
playbooks/templates/yml.j2
Normal file
1
playbooks/templates/yml.j2
Normal file
|
@ -0,0 +1 @@
|
|||
{{ yml | to_nice_yaml }}
|
Loading…
Add table
Add a link
Reference in a new issue