ansible-install-server/roles/fai/tasks/unbound.yml

35 lines
800 B
YAML
Raw Normal View History

2020-08-26 10:10:36 +00:00
- name: install unbound server
2020-10-14 22:20:05 +00:00
package:
2020-08-26 10:10:36 +00:00
name: unbound
state: present
- name: configure dns
copy:
content: |
server:
2020-10-14 22:20:05 +00:00
access-control: {{ server_net }}.0/{{ server_netbits }} allow
private-domain: "{{ domain_name }}"
domain-insecure: "{{ domain_name }}"
2020-08-26 10:10:36 +00:00
interface: 0.0.0.0
2020-10-14 22:20:05 +00:00
local-zone: "{{ domain_name }}." static
local-data: "{{ server_name }}.{{ domain_name }}. IN A {{ server_ip }}"
2020-08-26 10:10:36 +00:00
dest: /etc/unbound/unbound.conf.d/fai.conf
2020-10-14 22:20:05 +00:00
mode: u=rw,g=r,o=r
2020-08-26 10:10:36 +00:00
owner: root
group: root
register: unbound_conf
- name: ensure unbound is enabled and running
service:
name: unbound
state: started
enabled: true
2020-08-26 10:10:36 +00:00
- name: apply dns config
systemd:
name: unbound
state: restarted
when: unbound_conf.changed