add systemd-resolved consul forwarding

add systemd-resolved consul redirection
This commit is contained in:
vincent 2023-10-21 15:17:06 +02:00
parent bd58af864c
commit 875cdad424
5 changed files with 31 additions and 0 deletions

View File

@ -32,3 +32,4 @@ consul_backup_location: ""
consul_cron_hour: 1
consul_retry_join_force:
consul_dnsmasq_enable: False
consul_systemd_resolved_enable: False

View File

@ -9,3 +9,8 @@
name: dnsmasq
enabled: true
state: restarted
- name: restart systemd-resolved
ansible.builtin.service:
name: systemd-resolved
enabled: true
state: restarted

View File

@ -178,3 +178,7 @@
- include_tasks: dnsmasq.yml
when: consul_dnsmasq_enable | bool
- name: include systemd-resolved
ansible.builtin.include_tasks: systemd-resolved.yml
when: consul_systemd_resolved_enable

View File

@ -0,0 +1,17 @@
---
- name: Ensure resolved.conf.d is present
ansible.builtin.file:
path: /etc/systemd/resolved.conf.d
state: directory
owner: root
group: root
mode: "755"
- name: "Template resolved consul config"
ansible.builtin.template:
src: resolved.conf.d/consul.conf.j2
dest: /etc/systemd/resolved.conf.d/consul.conf
group: root
owner: root
mode: "644"
notify: restart systemd-resolved

View File

@ -0,0 +1,4 @@
[Resolve]
DNS=127.0.0.1:8600
DNSSEC=false
Domains=~consul