]> git.somenet.org - root/pub/somesible.git/blob - roles/server/named/tasks/main.yml
roles/service/nextcloud/defaults
[root/pub/somesible.git] / roles / server / named / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install dns-server
9   apt:
10     pkg:
11     - bind9
12     state: present
13     policy_rc_d: 101
14   tags: "online"
15   ignore_errors: "{{ignore_online_errors | bool}}"
16
17
18 - name: copy bind named.conf.local config file
19   copy:
20     src: "{{item}}"
21     dest: "/etc/bind/named.conf.local"
22     mode: 0644
23     owner: "root"
24     group: "root"
25   with_first_found:
26     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/named.conf.local"
27     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/named.conf.local"
28     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/named.conf.local"
29     - "default/named.conf.local"
30   notify: restart named.service
31
32
33 - name: copy bind named.conf.options config file
34   copy:
35     src: "{{item}}"
36     dest: "/etc/bind/named.conf.options"
37     mode: 0644
38     owner: "root"
39     group: "root"
40   with_first_found:
41     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/named.conf.options"
42     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/named.conf.options"
43     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/named.conf.options"
44     - "default/named.conf.options"
45   notify: restart named.service
46
47
48 - name: create bind db dir
49   file:
50     path: "/etc/bind/db"
51     state: directory
52     mode: 0755
53     owner: "root"
54     group: "root"
55
56
57 # for each zone do a with first found.
58 - include_tasks: configure-zones.yml
59   with_items: "{{named_zones}}"
60   loop_control:
61     loop_var: zone
62   when: named_zones is defined
63
64
65 - name: enable and start named.service
66   include_role: name="base/systemd/enable-and-start"
67   vars:
68     service_name: named.service