mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
31
roles/unbound/tasks/main.yml
Normal file
31
roles/unbound/tasks/main.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
|
||||
- name: Install packages
|
||||
yum:
|
||||
name:
|
||||
- unbound
|
||||
tags: unbound
|
||||
|
||||
- name: Fetch the root hints
|
||||
get_url:
|
||||
url: https://www.internic.net/domain/named.cache
|
||||
dest: /etc/unbound/root.hints
|
||||
tags: unbound
|
||||
|
||||
- name: Deploy unbound configuration
|
||||
template: src=unbound.conf.j2 dest=/etc/unbound/unbound.conf
|
||||
notify: restart unbound
|
||||
tags: unbound
|
||||
|
||||
- name: Handle port in the firewall
|
||||
iptables_raw:
|
||||
name: unbound_ports
|
||||
state: "{{ (unbound_src_ip | length > 0) | ternary('present','absent') }}"
|
||||
rules: "-A INPUT -m state --state NEW -p udp -m multiport --dports {{ unbound_port }} -s {{ unbound_src_ip | join(',') }} -j ACCEPT\n
|
||||
-A INPUT -m state --state NEW -p tcp -m multiport --dports {{ unbound_port }} -s {{ unbound_src_ip | join(',') }} -j ACCEPT"
|
||||
when: iptables_manage | default(True)
|
||||
tags: [unbound,firewall]
|
||||
|
||||
- name: Start and enable the service
|
||||
service: name=unbound state=started enabled=True
|
||||
tags: unbound
|
Reference in New Issue
Block a user