mirror of
https://github.com/roles-ansible/ansible_role_unbound.git
synced 2024-08-16 13:39:49 +02:00
Merge pull request #6 from roles-ansible/simplfy
improve validating mechanism
This commit is contained in:
commit
b2a6da9fe5
6 changed files with 44 additions and 46 deletions
|
@ -1,14 +1,4 @@
|
||||||
---
|
---
|
||||||
- name: unbound checkconf
|
|
||||||
become: true
|
|
||||||
ansible.builtin.command: unbound-checkconf /etc/unbound/unbound.conf
|
|
||||||
retries: 5
|
|
||||||
delay: 3
|
|
||||||
register: result
|
|
||||||
until: result.rc == 0
|
|
||||||
|
|
||||||
notify: systemctl restart unbound
|
|
||||||
|
|
||||||
- name: systemctl restart unbound
|
- name: systemctl restart unbound
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
|
|
|
@ -11,6 +11,10 @@ galaxy_info:
|
||||||
versions: all
|
versions: all
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions: all
|
versions: all
|
||||||
|
- name: Fedora
|
||||||
|
versions: all
|
||||||
|
- name: EL
|
||||||
|
versions: all
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- unbound
|
- unbound
|
||||||
- dns
|
- dns
|
||||||
|
|
23
tasks/configure.yml
Normal file
23
tasks/configure.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
---
|
||||||
|
- name: Copy unbound configuration snippets
|
||||||
|
become: true
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: '{{ item }}'
|
||||||
|
dest: '/etc/unbound/unbound.conf.d/'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 'u=rw,g=r,o=r'
|
||||||
|
with_fileglob:
|
||||||
|
- 'files/snippets/*.conf'
|
||||||
|
notify: systemctl restart unbound
|
||||||
|
|
||||||
|
- name: Copy main unbound configuration
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'files/unbound.conf'
|
||||||
|
dest: '/etc/unbound/unbound.conf'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 'u=rw,g=r,o=r'
|
||||||
|
validate: unbound-checkconf %s
|
||||||
|
notify: systemctl restart unbound
|
13
tasks/install.yml
Normal file
13
tasks/install.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- name: update debian cache
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
cache_valid_time: 43200
|
||||||
|
when: ansible_pkg_mgr == "apt"
|
||||||
|
|
||||||
|
- name: install unbound
|
||||||
|
become: true
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: unbound
|
||||||
|
state: "{{ unbound__state }}"
|
|
@ -3,40 +3,8 @@
|
||||||
ansible.builtin.include_tasks: versioncheck.yml
|
ansible.builtin.include_tasks: versioncheck.yml
|
||||||
when: submodules_versioncheck|bool
|
when: submodules_versioncheck|bool
|
||||||
|
|
||||||
- name: update cache
|
|
||||||
become: true
|
|
||||||
ansible.builtin.apt:
|
|
||||||
state: "{{ unbound__state }}"
|
|
||||||
update_cache: true
|
|
||||||
cache_valid_time: 43200
|
|
||||||
when: ansible_pkg_mgr == "apt"
|
|
||||||
|
|
||||||
- name: install unbound
|
- name: install unbound
|
||||||
become: true
|
ansible.builtin.include_tasks: install.yml
|
||||||
ansible.builtin.package:
|
|
||||||
name: unbound
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Copy unbound configuration snippets
|
- name: configure unbound
|
||||||
become: true
|
ansible.builtin.include_tasks: configure.yml
|
||||||
ansible.builtin.copy:
|
|
||||||
src: '{{ item }}'
|
|
||||||
dest: '/etc/unbound/unbound.conf.d/'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 'u=rw,g=r,o=r'
|
|
||||||
with_fileglob:
|
|
||||||
- 'files/snippets/*.conf'
|
|
||||||
notify:
|
|
||||||
- unbound checkconf
|
|
||||||
|
|
||||||
- name: Copy main unbound configuration
|
|
||||||
become: true
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: 'files/unbound.conf'
|
|
||||||
dest: '/etc/unbound/unbound.conf'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 'u=rw,g=r,o=r'
|
|
||||||
notify:
|
|
||||||
- unbound checkconf
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
playbook_version_number: 68 # should be integer
|
playbook_version_number: 69 # should be integer
|
||||||
playbook_version_path: 'role-unbound_roles-ansible_github.com.version'
|
playbook_version_path: 'role-unbound_roles-ansible_github.com.version'
|
||||||
|
|
Loading…
Reference in a new issue