there is a weird bug with adguard in docker, needs investigation

This commit is contained in:
Bertrand Lanson 2023-06-04 01:02:00 +02:00
parent 529bcc3a20
commit 674fabd392
6 changed files with 63 additions and 1 deletions

View File

@ -18,3 +18,10 @@
listen: "systemctl-restart-adguard"
throttle: 1
when: deploy_adguard_start_service
- name: "Enable adguard-connect-proxy service"
ansible.builtin.service:
name: adguard-connect-proxy
enabled: true
state: restarted
listen: "systemctl-enable-restart-adguard-connect-proxy"

41
tasks/consul_service.yml Normal file
View File

@ -0,0 +1,41 @@
---
# task/consul_service file for deploy_adguard
- name: "Copy adguard.consul.json file"
ansible.builtin.template:
src: "adguard.consul.json.j2"
dest: "{{ deploy_adguard_directory }}/adguard.consul.json"
owner: root
group: root
mode: '0644'
register: _copy_service_template
- name: "Register/Update consul service"
ansible.builtin.command: "consul services register {{ deploy_adguard_directory }}/adguard.consul.json"
environment:
CONSUL_HTTP_ADDR: "{{ deploy_adguard_consul['consul_addr'] }}"
CONSUL_HTTP_TOKEN: "{{ deploy_adguard_consul['consul_token'] }}"
when: _copy_service_template.changed
- name: "Configure service mesh proxy"
when: deploy_adguard_consul['configuration']['service']['connect'] is defined
block:
- name: "Copy adguard-connect-proxy.env file"
ansible.builtin.template:
src: "adguard-connect-proxy.env.j2"
dest: "{{ deploy_adguard_directory }}/adguard-connect-proxy.env"
owner: root
group: root
mode: '0644'
notify:
- "systemctl-enable-restart-adguard-connect-proxy"
- name: "Copy adguard-connect-proxy.service file"
ansible.builtin.template:
src: "adguard-connect-proxy.service.j2"
dest: "/etc/systemd/system/adguard-connect-proxy.service"
owner: root
group: root
mode: '0644'
notify:
- "systemctl-daemon-reload"
- "systemctl-enable-restart-adguard-connect-proxy"

View File

@ -5,3 +5,7 @@
- name: "Import configure.yml"
ansible.builtin.include_tasks: configure.yml
- name: "Import consul_service.yml"
ansible.builtin.include_tasks: consul_service.yml
when: deploy_adguard_consul['enable']

View File

@ -0,0 +1,3 @@
# {{ ansible_managed }}
CONSUL_HTTP_ADDR="{{ deploy_adguard_consul['consul_addr'] }}"
CONSUL_HTTP_TOKEN="{{ deploy_adguard_consul['consul_token'] }}"

View File

@ -3,7 +3,8 @@ Description=Consul Envoy Proxy for Adguard.
After=adguard.service,consul.service
[Service]
ExecStart=/usr/local/bin/consul connect envoy -sidecar-for {{ deploy_adguard_consul['configuration']['service']['name'] }}
EnvironmentFile=-{{ deploy_adguard_directory }}/adguard-connect-proxy.env
ExecStart=/usr/bin/consul connect envoy -sidecar-for {{ deploy_adguard_consul['configuration']['service']['name'] }}
Restart=always
RestartSec=3

View File

@ -16,6 +16,10 @@ services:
{% endif %}
adguard:
image: adguard/adguardhome:latest
{% if deploy_adguard_virtual_ip['enable']%}
depends_on:
- keepalived
{% endif %}
ports:
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/tcp"
- "{% if deploy_adguard_virtual_ip['enable'] %}{{ deploy_adguard_virtual_ip['vip_addr'] }}:{% endif %}53:53/udp"
@ -53,6 +57,8 @@ services:
node_exporter:
image: ebrianne/adguard-exporter:latest
depends_on:
- adguard
secrets:
- adguard_passw
environment: