65 lines
1.3 KiB
YAML
65 lines
1.3 KiB
YAML
---
|
|
- name: "save dhclients dns and dhcp in a file"
|
|
lineinfile:
|
|
path: "/etc/resolvconf.conf"
|
|
regexp: "^{{ item.name }}"
|
|
line: "{{ item.name }}={{ item.val }}"
|
|
become: true
|
|
loop: "{{ sysctl_setting }}"
|
|
tags:
|
|
- configuration
|
|
vars:
|
|
sysctl_setting:
|
|
- name: "resolv_conf"
|
|
val: "/etc/resolv.conf.dhcp"
|
|
|
|
- name: "enable local_unbound"
|
|
lineinfile:
|
|
path: "/etc/rc.conf"
|
|
regexp: "^{{ item.name }}"
|
|
line: "{{ item.name }}={{ item.val }}"
|
|
become: true
|
|
loop: "{{ sysctl_setting }}"
|
|
tags:
|
|
- configuration
|
|
vars:
|
|
sysctl_setting:
|
|
- name: "local_unbound_enable"
|
|
val: "YES"
|
|
|
|
- name: manage resolv.conf
|
|
template:
|
|
dest: /etc/resolv.conf
|
|
src: templates/resolv.conf.j2
|
|
become: true
|
|
tags:
|
|
- configuration
|
|
|
|
- name: "generate access control"
|
|
template:
|
|
dest: "/etc/unbound/conf.d/access_control.conf"
|
|
src: "templates/access_control.j2"
|
|
become: true
|
|
tags:
|
|
- configuration
|
|
notify: "restart local_unbound"
|
|
|
|
- name: "generate overlay for local dns"
|
|
template:
|
|
dest: "/etc/unbound/conf.d/local_resolver.conf"
|
|
src: "templates/local_resolver.j2"
|
|
become: true
|
|
tags:
|
|
- configuration
|
|
notify: "restart local_unbound"
|
|
|
|
- name: "start local_unbound"
|
|
service:
|
|
name: "local_unbound"
|
|
state: started
|
|
become: true
|
|
tags:
|
|
- service
|
|
- configuration
|
|
|
|
|