tweaks/tasks/FreeBSD-localunbound.yml

77 lines
1.5 KiB
YAML

---
- include_vars: local_unbound.yml
- 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: "get opennic hints"
shell: "{{ hints_opennic_cmd }}"
become: true
tags:
- installation
- configuration
- name: "get named hints"
get_url:
url: "{{ hints_named_url }}"
dest: "{{ hints_named }}"
become: true
tags:
- installation
- configuration
- name: manage resolv.conf
template:
dest: /etc/resolv.conf
src: templates/resolv.conf.j2
become: true
tags:
- configuration
- name: "generate configs"
template:
src: "{{ config.src }}"
dest: "{{ config.dest }}"
become: true
loop: "{{ local_unbound_files }}"
loop_control:
loop_var: config
tags:
- configuration
notify: "restart local_unbound"
- name: "start local_unbound"
service:
name: "local_unbound"
state: started
become: true
tags:
- service
- configuration