You've already forked ansible-role-bind9
Initial Commit
This commit is contained in:
70
tasks/main.yml
Normal file
70
tasks/main.yml
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
|
||||
- name: include special distribution-dependent variables
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: install bind and dependencies
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ bind_package_names }}"
|
||||
|
||||
- name: create logging directory
|
||||
file:
|
||||
path: "{{ bind_log_directory }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0755
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: remove existing journal files
|
||||
block:
|
||||
- name: find existing journal files
|
||||
find:
|
||||
path: "{{ bind_config_directory }}"
|
||||
recurse: yes
|
||||
patterns: "*.jnl"
|
||||
register: files_to_delete
|
||||
- name: delete existing journal files
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ files_to_delete.files }}"
|
||||
|
||||
|
||||
# - name: copy zone files
|
||||
# include_tasks: copy_zone_files.yml
|
||||
# with_items:
|
||||
# - "{{ bind9_views }}"
|
||||
# loop_control:
|
||||
# loop_var: view
|
||||
|
||||
- name: template zone files
|
||||
include_tasks: template_zone_files.yml
|
||||
with_items:
|
||||
- "{{ bind9_views }}"
|
||||
loop_control:
|
||||
loop_var: view
|
||||
|
||||
- name: set up global bind config
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/etc/{{ item }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- named.conf
|
||||
- named/named.conf.acl
|
||||
- named/named.conf.logging
|
||||
- named/named.conf.options
|
||||
- named/named.conf.tsigkeys
|
||||
- named/named.conf.views
|
||||
notify: restart named
|
||||
|
||||
- name: start and enabled named
|
||||
systemd:
|
||||
name: named
|
||||
state: started
|
||||
enabled: yes
|
27
tasks/template_zone_files.yml
Normal file
27
tasks/template_zone_files.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: create directory for zone {{ zone.file | dirname }}
|
||||
file:
|
||||
path: "{{ bind_config_directory }}/{{ zone.file | dirname }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0755
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
|
||||
- name: "template view {{ view.name }}"
|
||||
template:
|
||||
src: "{{ inventory_hostname }}/etc/named/{{ zone.file }}.j2"
|
||||
dest: "{{ bind_config_directory }}/{{ zone.file }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.type == 'master'
|
||||
notify: restart named
|
Reference in New Issue
Block a user