From b196972b96444d6641962389243349e2e9635f59 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Thu, 14 Oct 2021 15:16:11 +0200 Subject: [PATCH] . --- salt/states/dnsmasq/files/dnsmasq.conf.jinja | 17 ---------- salt/states/dnsmasq/files/local.cfg.jinja | 12 ------- salt/states/dnsmasq/init.sls | 33 +++----------------- 3 files changed, 4 insertions(+), 58 deletions(-) delete mode 100644 salt/states/dnsmasq/files/dnsmasq.conf.jinja delete mode 100644 salt/states/dnsmasq/files/local.cfg.jinja diff --git a/salt/states/dnsmasq/files/dnsmasq.conf.jinja b/salt/states/dnsmasq/files/dnsmasq.conf.jinja deleted file mode 100644 index b0ecd69..0000000 --- a/salt/states/dnsmasq/files/dnsmasq.conf.jinja +++ /dev/null @@ -1,17 +0,0 @@ -interface={{ interface }} -listen-address= {{ ip }} -bind-interfaces -domain-needed -bogus-priv -dhcp-range={{ ip[0:-1] }}50,{{ ip[0:-1] }}150,12h -dhcp-option=option:ntp-server,192.168.0.4,{{ ip }} -dhcp-option=66,{{ ip }} -enable-tftp -tftp-root=/srv/tftpboot -dhcp-match=set:efi-x86_64,option:client-arch,7 -dhcp-match=set:efi-x86_64,option:client-arch,9 -dhcp-match=set:efi-x86,option:client-arch,6 -dhcp-match=set:bios,option:client-arch,0 -dhcp-boot=tag:efi-x86_64,bootx64.efi -dhcp-boot=tag:efi-x86,syslinux.efi -dhcp-boot=tag:bios,pxelinux.0 diff --git a/salt/states/dnsmasq/files/local.cfg.jinja b/salt/states/dnsmasq/files/local.cfg.jinja deleted file mode 100644 index 72f0f43..0000000 --- a/salt/states/dnsmasq/files/local.cfg.jinja +++ /dev/null @@ -1,12 +0,0 @@ -except-interface={{ pillar['network']['interface']['external'] }} -domain-needed -bogus-priv -enable-tftp -tftp-root=/srv/tftpboot -dhcp-match=set:efi-x86_64,option:client-arch,7 -dhcp-match=set:efi-x86_64,option:client-arch,9 -dhcp-match=set:efi-x86,option:client-arch,6 -dhcp-match=set:bios,option:client-arch,0 -dhcp-boot=tag:efi-x86_64,bootx64.efi -dhcp-boot=tag:efi-x86,syslinux.efi -dhcp-boot=tag:bios,pxelinux.0 diff --git a/salt/states/dnsmasq/init.sls b/salt/states/dnsmasq/init.sls index a3dc3f4..524b496 100644 --- a/salt/states/dnsmasq/init.sls +++ b/salt/states/dnsmasq/init.sls @@ -2,43 +2,18 @@ Install dnsmasq: pkg.installed: - name: dnsmasq -{% set ip = pillar['network']['ip'] -%} -{% set interface = pillar['network']['interface']['internal'] -%} -configure dnsmasq for internal interface: +configure dnsmasq: file.managed: - - name: /etc/dnsmasq.d/{{ interface }}.conf - - source: salt://dnsmasq/files/dnsmasq.conf.jinja + - name: /etc/dnsmasq.d/tlu.conf + - source: salt://dnsmasq/files/tlu.conf.jinja - template: jinja - user: root - group: root - mode: "0644" - - context: - ip: {{ ip }} - interface: {{ interface }} - -{% for vlan in pillar['network']['vlan'] -%} -{% set id = vlan['id'] -%} -{% set ip = vlan['address'] -%} -configure dnsmasq for vlan.{{ id }}: - file.managed: - - name: /etc/dnsmasq.d/vlan.{{ id }}.conf - - source: salt://dnsmasq/files/dnsmasq.conf.jinja - - template: jinja - - user: root - - group: root - - mode: "0644" - - context: - ip: {{ ip }} - interface: vlan.{{ id }} -{% endfor %} Start dnsmasq: service.running: - name: dnsmasq - enable: True - watch: - - file: configure dnsmasq for internal interface - {% for vlan in pillar['network']['vlan'] -%} - {% set id = vlan['id'] -%} - - file: configure dnsmasq for vlan.{{ id }} - {% endfor %} + - file: configure dnsmasq