Move all of the role here
This commit is contained in:
47
tasks/main.yml
Normal file
47
tasks/main.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# tasks file for bind9
|
||||
- name: Install bind9
|
||||
ansible.builtin.apt:
|
||||
name: "{{ bind9_packages }}"
|
||||
state: present
|
||||
tags:
|
||||
- bind9
|
||||
- packages
|
||||
|
||||
- name: Ensure backup directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_backup_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0750
|
||||
when: bind9_backup_config is defined and bind9_backup_config
|
||||
|
||||
- name: named.conf.generator
|
||||
ansible.builtin.template:
|
||||
src: named.conf.generator.j2
|
||||
dest: "{{ bind9_cfgdir }}/{{ item.name }}"
|
||||
owner: root
|
||||
group: bind
|
||||
backup: "{{ item.backup | default('false') | bool }}"
|
||||
# validate: 'named-checkconf -z -j %s'
|
||||
loop: "{{ bind9_config }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
tags:
|
||||
- bind9
|
||||
- template
|
||||
notify:
|
||||
- backup bind config
|
||||
- restart bind
|
||||
|
||||
- name: Ensure the named service is started
|
||||
ansible.builtin.service:
|
||||
name: named
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Print the bind9_config
|
||||
ansible.builtin.debug:
|
||||
var: bind9_config
|
||||
when: bind9_debug_config | bool
|
||||
Reference in New Issue
Block a user