You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
---
|
|
|
|
- name: 'Insert/Update caddy configuration in {{ caddy_config_file_path_full }}'
|
|
blockinfile:
|
|
marker: '# {mark} managed by ansible (reverse proxy config for {{ current_service }})'
|
|
path: '{{ caddy_config_file_path_full }}'
|
|
state: "{{ 'present' if reverse_proxy == 'caddy' else 'absent' }}"
|
|
create: yes
|
|
block: |
|
|
{% for service in current_services %}
|
|
{{ http_s }}://{{ service.external }} {
|
|
proxy / {{ service.internal }} {
|
|
transparent
|
|
}
|
|
tls {{ caddy_tls }}
|
|
{% if service.basicauth is defined %}
|
|
basicauth {{ service.basicauth }}
|
|
{% endif %}
|
|
}
|
|
{% endfor %}
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Stop caddy"
|
|
shell: docker-compose down
|
|
args:
|
|
chdir: '{{ service_base_path }}/caddy'
|
|
ignore_errors: yes
|
|
when: reverse_proxy == 'caddy'
|
|
tags:
|
|
- update_deployment
|
|
|
|
- name: "Start caddy"
|
|
shell: docker-compose up -d
|
|
args:
|
|
chdir: '{{ service_base_path }}/caddy'
|
|
when: reverse_proxy == 'caddy'
|
|
tags:
|
|
- update_deployment
|