You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
1.8 KiB
93 lines
1.8 KiB
- name: install coredns and dependencies
|
|
include_tasks: tasks/install_packages.yml
|
|
vars:
|
|
package:
|
|
- coredns
|
|
- alpine: coredns-openrc
|
|
|
|
|
|
- name: create user and group
|
|
include_tasks: tasks/create_user.yml
|
|
vars:
|
|
user:
|
|
name: "{{ coredns_user }}"
|
|
group: "{{ coredns_group }}"
|
|
|
|
|
|
- name: create config directory
|
|
file:
|
|
path: "{{ coredns_conf_dir }}"
|
|
state: directory
|
|
owner: "{{ coredns_user }}"
|
|
group: "{{ coredns_group }}"
|
|
notify: restart coredns
|
|
|
|
|
|
- name: template corefile
|
|
template:
|
|
src: corefile.j2
|
|
dest: "{{ coredns_conf_file }}"
|
|
force: yes
|
|
owner: "{{ coredns_user }}"
|
|
group: "{{ coredns_group }}"
|
|
mode: 0400
|
|
notify: restart coredns
|
|
|
|
|
|
- name: template empty tls file if missing
|
|
copy:
|
|
content: ''
|
|
dest: "{{ coredns_tls_file }}"
|
|
force: no
|
|
owner: "{{ coredns_user }}"
|
|
group: "{{ coredns_group }}"
|
|
mode: 0400
|
|
notify: restart coredns
|
|
|
|
|
|
- name: template root zone if missing
|
|
template:
|
|
src: zone.j2
|
|
dest: "{{ coredns_conf_dir ~ '/' ~ (ns_tld | d(int_tld)) ~ '.zone' }}"
|
|
force: no
|
|
mode: 0400
|
|
owner: "{{ coredns_user }}"
|
|
group: "{{ coredns_group }}"
|
|
notify: restart coredns
|
|
|
|
|
|
- name: edit service config
|
|
lineinfile:
|
|
path: /etc/conf.d/coredns
|
|
regexp: "^COREDNS_CONFIG="
|
|
line: "COREDNS_CONFIG={{ coredns_conf_file | quote }}"
|
|
notify: restart coredns
|
|
|
|
|
|
- name: template init script
|
|
template:
|
|
src: init.j2
|
|
dest: /etc/init.d/coredns
|
|
force: yes
|
|
mode: 0755
|
|
notify: restart coredns
|
|
|
|
|
|
- name: flush handlers
|
|
meta: flush_handlers
|
|
|
|
|
|
- name: add directories to backup plan
|
|
include_role:
|
|
name: backup
|
|
vars:
|
|
function: add
|
|
backup_items:
|
|
- "{{ coredns_conf_dir }}"
|
|
|
|
|
|
- name: enable and start coredns
|
|
service:
|
|
name: coredns
|
|
enabled: yes
|
|
state: started
|
|
|