knot: rewrite role
This commit is contained in:
40
roles/knot/tasks/main.yaml
Normal file
40
roles/knot/tasks/main.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: Make sure handlers are flushed immediately
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Load a variable file based on the OS type
|
||||
include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}.yaml"
|
||||
- main.yaml
|
||||
paths:
|
||||
- "vars"
|
||||
tags: knot_vars
|
||||
|
||||
- name: Include knot install for {{ ansible_distribution }}
|
||||
include_tasks: "{{ ansible_facts['os_family'] }}.yaml"
|
||||
|
||||
- name: Configure knot
|
||||
copy:
|
||||
content: "{{ knot_conf }}"
|
||||
dest: /etc/knot/knot.conf
|
||||
mode: 0640
|
||||
owner: "root"
|
||||
group: "knot"
|
||||
validate: "knotc -c %s conf-check"
|
||||
notify: Restart knot
|
||||
|
||||
- name: Enable and start knot
|
||||
systemd:
|
||||
name: "knot"
|
||||
enabled: true
|
||||
state: started
|
||||
masked: false
|
||||
daemon_reload: true
|
Reference in New Issue
Block a user