Merge "validate-zone-db : add job and make more generic"
This commit is contained in:
commit
ad16143c23
@ -6,3 +6,4 @@ General Purpose Jobs
|
|||||||
.. zuul:autojob:: multinode
|
.. zuul:autojob:: multinode
|
||||||
.. zuul:autojob:: run-test-command
|
.. zuul:autojob:: run-test-command
|
||||||
.. zuul:autojob:: upload-git-mirror
|
.. zuul:autojob:: upload-git-mirror
|
||||||
|
.. zuul:autojob:: validate-zone-db
|
||||||
|
4
playbooks/validate-zone-db/run.yaml
Normal file
4
playbooks/validate-zone-db/run.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- hosts: all
|
||||||
|
name: Run zone.db check
|
||||||
|
roles:
|
||||||
|
- validate-zone-db
|
@ -9,4 +9,14 @@ This role uses ``named-checkzone`` to validate Bind ``zone.db`` files.
|
|||||||
|
|
||||||
Look for ``zone.db`` files recursively in this directory. The
|
Look for ``zone.db`` files recursively in this directory. The
|
||||||
layout should be ``domain.xyz/zone.db`` where a parent directory is
|
layout should be ``domain.xyz/zone.db`` where a parent directory is
|
||||||
named for the zone the child ``zone.db`` file describes.
|
named for the zone the child ``zone.db`` file describes. This
|
||||||
|
populates the ``zone_db_files`` variable. Will not be used if
|
||||||
|
``zone_db_files`` is explicitly set per below.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: zone_db_files
|
||||||
|
:default: []
|
||||||
|
|
||||||
|
A list of ``zone.db`` files to check. Each entry is a list with
|
||||||
|
the first element the domain, and the second element the path to
|
||||||
|
the ``zone.db`` file. If this variable is set, automatic searching
|
||||||
|
described by ``zone_files`` will not be performed.
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
zone_files: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}'
|
zone_files: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}'
|
||||||
|
zone_db_files: []
|
||||||
|
|
||||||
|
12
roles/validate-zone-db/tasks/find.yaml
Normal file
12
roles/validate-zone-db/tasks/find.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
- name: Find zone files
|
||||||
|
find:
|
||||||
|
paths: '{{ zone_files }}'
|
||||||
|
patterns: 'zone.db'
|
||||||
|
recurse: yes
|
||||||
|
file_type: 'file'
|
||||||
|
register: zone_db_found_files
|
||||||
|
|
||||||
|
- name: Build zone.db file list
|
||||||
|
set_fact:
|
||||||
|
zone_db_files: '{{ zone_db_files + [ [item.path.split("/")[-2], item.path] ] }}'
|
||||||
|
loop: "{{ zone_db_found_files['files'] }}"
|
@ -4,14 +4,10 @@
|
|||||||
state: present
|
state: present
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: Find zone files
|
- name: Build zone.db list
|
||||||
find:
|
include_tasks: find.yaml
|
||||||
paths: '{{ zone_files }}'
|
when: not zone_db_files
|
||||||
patterns: 'zone.db'
|
|
||||||
recurse: yes
|
|
||||||
file_type: 'file'
|
|
||||||
register: zone_db_files
|
|
||||||
|
|
||||||
- name: 'Run checkzone'
|
- name: 'Run checkzone'
|
||||||
command: '/usr/sbin/named-checkzone {{ item.path.split("/")[-2] }} {{ item.path }}'
|
command: '/usr/sbin/named-checkzone {{ item[0] }} {{ item[1] }}'
|
||||||
loop: "{{ zone_db_files['files'] }}"
|
loop: "{{ zone_db_files }}"
|
||||||
|
22
zuul.yaml
22
zuul.yaml
@ -574,3 +574,25 @@
|
|||||||
run: playbooks/run-test-command/run.yaml
|
run: playbooks/run-test-command/run.yaml
|
||||||
vars:
|
vars:
|
||||||
test_command: "exit 1"
|
test_command: "exit 1"
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: validate-zone-db
|
||||||
|
parent: base
|
||||||
|
description: |
|
||||||
|
Validate zone.db files in project.
|
||||||
|
|
||||||
|
Responds to these variables:
|
||||||
|
|
||||||
|
.. zuul:jobvar:: zone_files
|
||||||
|
:default: {{ ansible_user_dir }}/{{ zuul.project.src_dir }}
|
||||||
|
|
||||||
|
Search for zone.db files recursively in this directory.
|
||||||
|
Format should be domain.xyz/zone.db, where the parent
|
||||||
|
directory is named for the zone described.
|
||||||
|
|
||||||
|
.. zuul:jobvar:: zone_db_list
|
||||||
|
:default: []
|
||||||
|
|
||||||
|
Override the default searching above with explicit
|
||||||
|
domain/path references (see validate-zone-db role)
|
||||||
|
run: playbooks/validate-zone-db/run.yaml
|
Loading…
Reference in New Issue
Block a user