add dnsmasq role
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
interface=lo
|
||||||
|
interface=eth0
|
||||||
|
interface=eth0.2
|
||||||
|
interface=eth0.3
|
||||||
|
interface=eth0.4
|
||||||
|
interface=eth0.10
|
||||||
|
interface=eth0.11
|
||||||
|
interface=eth0.12
|
||||||
|
bind-dynamic
|
||||||
|
no-resolv
|
||||||
|
server=127.0.0.1#5353
|
||||||
|
#server=1.1.1.1
|
||||||
|
domain=lan
|
||||||
|
local=/lan/
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
server=/dev.oyacoi.ru/9.9.9.9
|
||||||
|
server=/vector.oyacoi.ru/9.9.9.9
|
||||||
|
server=/.themoviedb.org/9.9.9.9
|
||||||
|
server=/.tmdb.org/9.9.9.9
|
||||||
|
server=/tmdb-image-prod.b-cdn.net/9.9.9.9
|
||||||
|
server=/infolada.ru/217.113.115.150
|
||||||
|
server=/infolada.ru/217.113.114.100
|
||||||
|
server=/start.infolada.ru/217.113.115.150
|
||||||
|
server=/start.infolada.ru/217.113.114.100
|
||||||
|
conf-file=/var/lib/xray-lists/generated/nftsets.conf
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
dhcp-range=interface:eth0.3,10.3.0.200,10.3.0.254,255.255.255.0,2h
|
||||||
|
dhcp-option=interface:eth0.3,option:router,10.3.0.1
|
||||||
|
dhcp-option=interface:eth0.3,option:dns-server,10.3.0.1
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
filterwin2k
|
||||||
|
domain-needed
|
||||||
|
bogus-priv
|
||||||
|
cache-size=0
|
||||||
@@ -5,6 +5,18 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: deploy dnsmasq rule
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "/etc/dnsmasq.d/{{ item }}"
|
||||||
|
mode: "0644"
|
||||||
|
loop:
|
||||||
|
- 10-upstream.conf
|
||||||
|
- 20-custom-domains.conf
|
||||||
|
- 20-dhcp.conf
|
||||||
|
- 20-dns-optimizations.conf
|
||||||
|
notify: restart dnsmasq
|
||||||
|
|
||||||
- name: render local
|
- name: render local
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 90-local.conf.j2
|
src: 90-local.conf.j2
|
||||||
@@ -12,6 +24,13 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: restart dnsmasq
|
notify: restart dnsmasq
|
||||||
|
|
||||||
|
- name: render dhcp-host
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 90-dhcp-host.conf.j2
|
||||||
|
dest: /etc/dnsmasq.d/90-dhcp-host.conf
|
||||||
|
mode: "0644"
|
||||||
|
notify: restart dnsmasq
|
||||||
|
|
||||||
- name: render domain
|
- name: render domain
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 90-domains.conf.j2
|
src: 90-domains.conf.j2
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#jinja2: trim_blocks: True, lstrip_blocks: True
|
||||||
|
{% for item in groups[dnsmasq_managed_group] | sort %}
|
||||||
|
{% set client = hostvars[item] %}
|
||||||
|
{% set ip = client.container_ip | default(client.ansible_host | default(none)) %}
|
||||||
|
{% if client['dhcp-host'] is defined and client['dhcp-host'] and ip %}
|
||||||
|
{% set entries = client['dhcp-host'] if (client['dhcp-host'] is iterable and client['dhcp-host'] is not string) else [client['dhcp-host']] %}
|
||||||
|
{% for entry in entries %}
|
||||||
|
{% if entry.mac %}
|
||||||
|
dhcp-host={{ entry.mac }},{{ ip }},{{ item }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
Reference in New Issue
Block a user