45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
|
Install dnsmasq:
|
||
|
pkg.installed:
|
||
|
- name: dnsmasq
|
||
|
|
||
|
{% set ip = pillar['network']['ip'] -%}
|
||
|
{% set interface = pillar['network']['interface']['internal'] -%}
|
||
|
configure dnsmasq for internal interface:
|
||
|
file.managed:
|
||
|
- name: /etc/dnsmasq.d/{{ interface }}.conf
|
||
|
- source: salt://dnsmasq/files/dnsmasq.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 %}
|