Compare commits
141
Commits
71c4e61fe8
...
0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64df53222d
|
||
|
|
be77d303f9
|
||
|
|
7fffe37c10
|
||
|
|
9b57989430
|
||
|
|
d7826d46a1
|
||
|
|
65e088cdd5 | ||
|
|
c07e3c68e8
|
||
|
|
5a0aa536b1 | ||
|
|
8f11afc4ad
|
||
|
|
e4c7530e02 | ||
|
|
2c2e421b91
|
||
|
|
c9efc999f9 | ||
|
|
ee450d52db
|
||
|
|
3557776f17
|
||
|
|
efdd0d8493 | ||
|
|
a295216cd6
|
||
|
|
f82c9d1e1e | ||
|
|
7108f660d4
|
||
|
|
1e72df951f | ||
|
|
080e370205
|
||
|
|
0dcdda55fb
|
||
|
|
4cc68dfd13 | ||
|
|
7707c24ae9
|
||
|
|
747125ea54 | ||
|
|
1bc633f31d
|
||
|
|
0978bf3574 | ||
|
|
08ef16d144
|
||
|
|
7b506e95db | ||
|
|
5ad3caa461
|
||
|
|
79a1536f91 | ||
|
|
32f438abd1
|
||
|
|
f99dfbaa63 | ||
|
|
cae6c83eda
|
||
|
|
1e0d5e529d | ||
|
|
9ca47da9c1
|
||
|
|
9450dfe0aa
|
||
|
|
92a3f387f8
|
||
|
|
38e077086c
|
||
|
|
c4d66b7409
|
||
|
|
b68c8cf92a
|
||
|
|
3045d8fabe
|
||
|
|
2a17b15818 | ||
|
|
3e8b5317a1
|
||
|
|
c4da1a0292 | ||
|
|
26ed89502d
|
||
|
|
9681a1d134 | ||
|
|
9406232039
|
||
|
|
7aed0bc16f | ||
|
|
95c940f755
|
||
|
|
646b89d0ce | ||
|
|
ac849a4fbc
|
||
|
|
17ba8c87b2
|
||
|
|
1ad689e41d
|
||
|
|
73fc7feedb
|
||
|
|
5ca6f22180 | ||
|
|
b483664c5f
|
||
|
|
56e8079ce6 | ||
|
|
8e3ad790f4
|
||
|
|
234d1a95f1 | ||
|
|
a9e8dd2dd1
|
||
|
|
0c9e81f06d | ||
|
|
d6db96cf7d
|
||
|
|
236421efb2 | ||
|
|
3232f5d400
|
||
|
|
666146b6b3 | ||
|
|
4ed30e396f
|
||
|
|
8cd8caece1
|
||
|
|
6ee7e2a0ae
|
||
|
|
49623f7f52
|
||
|
|
20b27e1e6b
|
||
|
|
d8a04d3f1b | ||
|
|
b6a5d1c924
|
||
|
|
d0ed854384 | ||
|
|
7e139fc571
|
||
|
|
c0e254bd94 | ||
|
|
2cbd5d82a1
|
||
|
|
4f727a2bc9 | ||
|
|
ce76a15b09
|
||
|
|
827e96463f
|
||
|
|
f3cbc1d81b
|
||
|
|
b50fd28d22
|
||
|
|
63ff0433ff
|
||
|
|
5939225733
|
||
|
|
974a128275 | ||
|
|
35e10931a4
|
||
|
|
670820009c
|
||
|
|
d38b75dae5
|
||
|
|
73f0d2b6bf
|
||
|
|
9321ee64a5
|
||
|
|
4117cbda9a
|
||
|
|
0e6ad65746
|
||
|
|
36d8257cd2
|
||
|
|
220d23790a
|
||
|
|
aa33cf1f5c
|
||
|
|
9b70a69a9a
|
||
|
|
5b9064cd65
|
||
|
|
8458f49975
|
||
|
|
ab0f34f217
|
||
|
|
85ee72fe17
|
||
|
|
261cd45400
|
||
|
|
3ed4cc4862
|
||
|
|
497d261e70 | ||
|
|
345a8d3075
|
||
|
|
20bf0a7f9b
|
||
|
|
5bb333929b
|
||
|
|
ead1284611
|
||
|
|
0a689b2e93
|
||
|
|
7083f5e711
|
||
|
|
5bd3aab57b
|
||
|
|
7b7a1b05bc | ||
|
|
a2ff838c84
|
||
|
|
b756b319dc
|
||
|
|
b77e30e319 | ||
|
|
be4b20f584 | ||
|
|
d6cfc50ce3 | ||
|
|
19e6e3a5a0 | ||
|
|
38b4533838
|
||
|
|
90bdec9e98 | ||
|
|
f8370dc77b
|
||
|
|
6607a726b7
|
||
|
|
b2c61884ec
|
||
|
|
55c3ccae08
|
||
|
|
4ef83cee22
|
||
|
|
b35ba22a6d
|
||
|
|
66f7e70f48
|
||
|
|
f9958f7cac
|
||
|
|
1356dd6824
|
||
|
|
6b8b178405
|
||
|
|
b7cba859e2
|
||
|
|
937b6c85de
|
||
|
|
d0db9e6944
|
||
|
|
c19f3c9db4 | ||
|
|
015463f33a
|
||
|
|
b50e939de5 | ||
|
|
d16492d892 | ||
|
|
63aa5de50d
|
||
|
|
6bf4cef2d3 | ||
|
|
271c874529
|
||
|
|
0ecda4e57b
|
||
|
|
a96e09792c
|
||
|
|
6f0e1d5134
|
No files matched your search
@@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
skip_list: []
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
exclude_paths:
|
||||
- .gitea/
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: linter
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
|
||||
steps:
|
||||
- name: markdown lint
|
||||
commands:
|
||||
- markdownlint *.md
|
||||
image: docker.io/volkerraschek/markdownlint:0.31.1
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 50M
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
image: docker.io/drillster/drone-email:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: sync
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: github
|
||||
image: docker.io/appleboy/drone-git-push:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
settings:
|
||||
branch: master
|
||||
remote: ssh://git@github.com/volker-raschek/bind9-role.git
|
||||
force: true
|
||||
ssh_key:
|
||||
from_secret: ssh_key
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
image: docker.io/drillster/drone-email:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50
|
||||
memory: 25M
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- cron
|
||||
- push
|
||||
repo:
|
||||
- volker.raschek/bind9-role
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Ansible Linter
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
jobs:
|
||||
ansible-lint:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Run ansible-lint
|
||||
uses: ansible/ansible-lint@9bce2bfb8f4a984e6b13767bc0d6bf0a49492164 # v26.10.1
|
||||
with:
|
||||
args: "--config-file .ansible-lint.yml"
|
||||
setup_python: "true"
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Lint Markdown files
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
jobs:
|
||||
markdown-lint:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: DavidAnson/markdownlint-cli2-action@ded1f9488f68a970bc66ea5619e13e9b52e601cd # v23.2.0
|
||||
with:
|
||||
globs: '**/*.md'
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Molecule
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
molecule:
|
||||
name: Molecule
|
||||
runs-on: ubuntu-latest-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
path: bind9
|
||||
- name: Install molecule
|
||||
run: |
|
||||
apt update --yes
|
||||
apt install --yes python3-pip
|
||||
pip3 install --break-system-packages ansible-core molecule docker
|
||||
- name: Run molecule
|
||||
run: molecule test
|
||||
working-directory: bind9
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Release Ansible Role
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '**'
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release Ansible Role
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Ansible Galaxy
|
||||
run: |
|
||||
apt update --yes
|
||||
apt install --yes ansible
|
||||
- env:
|
||||
ANSIBLE_GALAXY_TOKEN: ${{ secrets.ANSIBLE_GALAXY_TOKEN }}
|
||||
name: Update Ansible Role in Ansible Galaxy
|
||||
run: |
|
||||
ansible-galaxy role import --token=${ANSIBLE_GALAXY_TOKEN} volker-raschek ${GITHUB_REPOSITORY#*/}
|
||||
@@ -0,0 +1 @@
|
||||
.ansible
|
||||
+4
-11
@@ -45,19 +45,17 @@ MD012:
|
||||
# MD013/line-length - Line length
|
||||
MD013:
|
||||
# Number of characters
|
||||
line_length: 80
|
||||
line_length: 120
|
||||
# Number of characters for headings
|
||||
heading_line_length: 80
|
||||
heading_line_length: 120
|
||||
# Number of characters for code blocks
|
||||
code_block_line_length: 80
|
||||
code_block_line_length: 120
|
||||
# Include code blocks
|
||||
code_blocks: false
|
||||
# Include tables
|
||||
tables: false
|
||||
# Include headings
|
||||
headings: true
|
||||
# Include headings
|
||||
headers: true
|
||||
# Strict length checking
|
||||
strict: false
|
||||
# Stern length checking
|
||||
@@ -70,11 +68,6 @@ MD022:
|
||||
# Blank lines below heading
|
||||
lines_below: 1
|
||||
|
||||
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||
MD024:
|
||||
# Only check sibling headings
|
||||
allow_different_nesting: true
|
||||
|
||||
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||
MD025:
|
||||
# Heading level
|
||||
@@ -141,4 +134,4 @@ MD046:
|
||||
# MD048/code-fence-style - Code fence style
|
||||
MD048:
|
||||
# Code fence syle
|
||||
style: "backtick"
|
||||
style: "backtick"
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"ansible.python.interpreterPath": "/bin/python",
|
||||
"files.associations": {
|
||||
"**/.gitea/**/*.yml": "yaml",
|
||||
"**/.gitea/**/*.yaml": "yaml",
|
||||
"docker-compose*.yml": "dockercompose",
|
||||
"*.yml": "ansible",
|
||||
"*.yaml": "ansible",
|
||||
".yamllint": "yaml",
|
||||
".yamllint.yml": "yaml",
|
||||
".yamllint.yaml": "yaml"
|
||||
},
|
||||
"rewrap.wrappingColumn": 120
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Documentation:
|
||||
# https://yamllint.readthedocs.io/en/stable/
|
||||
#
|
||||
|
||||
rules:
|
||||
brackets:
|
||||
forbid: false
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 2
|
||||
min-spaces-inside-empty: 0
|
||||
max-spaces-inside-empty: 0
|
||||
indentation:
|
||||
spaces: 2
|
||||
indent-sequences: false
|
||||
line-length:
|
||||
max: 360
|
||||
@@ -1,14 +1,13 @@
|
||||
# bind9-role
|
||||
|
||||
[](https://drone.cryptic.systems/volker.raschek/bind9-role)
|
||||
[](https://galaxy.ansible.com/volker_raschek/bind9_role)
|
||||
[](https://galaxy.ansible.com/ui/standalone/roles/volker-raschek/bind9/)
|
||||
|
||||
With following role can be bind installed and configured.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
ansible-galaxy install volker_raschek.bind9_role
|
||||
ansible-galaxy install volker_raschek.bind9
|
||||
```
|
||||
|
||||
## Supported distributions
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
---
|
||||
|
||||
bind9_acls:
|
||||
- name: "internalnets"
|
||||
permissions: []
|
||||
# - "111.222.111.222"
|
||||
|
||||
bind9_controls: []
|
||||
# - acls:
|
||||
# - localhost
|
||||
# inet: "127.0.0.1"
|
||||
# port: "953"
|
||||
# tsig_keys:
|
||||
# - rndc
|
||||
|
||||
bind9_logging:
|
||||
categories:
|
||||
- name: "security"
|
||||
channels:
|
||||
- "security_file"
|
||||
channels:
|
||||
- name: "security_file"
|
||||
file:
|
||||
path: "{{ bind9_log_directory }}/security.log"
|
||||
options: "versions 3 size 30m"
|
||||
severity: "dynamic"
|
||||
print_times: "yes"
|
||||
|
||||
bind9_options:
|
||||
allow_query: []
|
||||
allow_query_on: []
|
||||
allow_query_cache: []
|
||||
allow_query_cache_on: []
|
||||
allow_recursion:
|
||||
- "localhost"
|
||||
- "localnets"
|
||||
- "internalnets"
|
||||
allow_recursion_on: []
|
||||
allow_transfer: []
|
||||
allow_update: []
|
||||
allow_update_forwarding: []
|
||||
auth_nxdomain: false
|
||||
blackhole: []
|
||||
dnssec_accept_expired: false
|
||||
dnssec_validation: "auto"
|
||||
forwarders:
|
||||
- ip: "8.8.8.8" # Google IPv4
|
||||
port: "53"
|
||||
- ip: "8.8.4.4" # Google IPv4
|
||||
port: "53"
|
||||
- ip: "2001:4860:4860::8888" # Google IPv6
|
||||
port: "53"
|
||||
- ip: "2001:4860:4860::8844" # Google IPv6
|
||||
port: "53"
|
||||
- ip: "208.67.222.222" # OpenDNS IPv4
|
||||
port: "53"
|
||||
- ip: "208.67.220.220" # OpenDNS IPv4
|
||||
port: "53"
|
||||
- ip: "2620:0:ccc::2" # OpenDNS IPv6
|
||||
port: "53"
|
||||
- ip: "2620:0:ccd::2" # OpenDNS IPv6
|
||||
port: "53"
|
||||
interface_interval: 0
|
||||
key_directory: "/var/named/dnssec-keys"
|
||||
listen_on_ipv4:
|
||||
- "127.0.0.1"
|
||||
listen_on_ipv6:
|
||||
- "::1"
|
||||
max_transfer_time: "60"
|
||||
minimal_responses: "no"
|
||||
notify: "yes"
|
||||
recursion: "yes"
|
||||
update_policies: []
|
||||
# - action: grant
|
||||
# identity: keyname
|
||||
# ruletype: name
|
||||
# name: _acme-challenge.example.com.
|
||||
# types:
|
||||
# - TXT
|
||||
|
||||
transfer_format: "many-answers"
|
||||
|
||||
bind9_rndc_key:
|
||||
name: ""
|
||||
algorithm: ""
|
||||
secret: ""
|
||||
|
||||
bind9_dnssec_keys: []
|
||||
# - origin: "hellenthal.cryptic.systems"
|
||||
# key_signing_key:
|
||||
# private:
|
||||
# filename: "{{ bind9_options.key_directory }}/example.com.private"
|
||||
# content: "private key"
|
||||
# public:
|
||||
# filename: "{{ bind9_options.key_directory }}/example.com.private"
|
||||
# content: "public key"
|
||||
# zone_signing_key:
|
||||
# private:
|
||||
# filename: "{{ bind9_options.key_directory }}/example.com.private"
|
||||
# content: "private key"
|
||||
# public:
|
||||
# filename: "{{ bind9_options.key_directory }}/example.com.private"
|
||||
# content: "public key"
|
||||
|
||||
bind9_statics:
|
||||
enabled: true
|
||||
channels:
|
||||
- inet: "127.0.0.1"
|
||||
port: "8053"
|
||||
acls:
|
||||
- "localhost"
|
||||
|
||||
bind9_systemd_dropin: ~
|
||||
# [Service]
|
||||
# ExecStart=
|
||||
# ExecStart={{ bind9_binary }} -f -u {{ bind9_unix_user }} -4
|
||||
|
||||
bind9_tsigkeys: []
|
||||
# - name: "name"
|
||||
# algorithm: "algorithm"
|
||||
# secret: "secret"
|
||||
|
||||
bind9_views: []
|
||||
# - name: "external"
|
||||
# match_clients:
|
||||
# - "!internalnets"
|
||||
# - "any"
|
||||
# zones:
|
||||
# - config:
|
||||
# allow_notify: []
|
||||
# allow_query:
|
||||
# - "any"
|
||||
# allow_query_on: []
|
||||
# allow_update: []
|
||||
# allow_update_forwarding: []
|
||||
# allow_transfer: []
|
||||
# file: zones/external/db.local.example
|
||||
# origin: "example.local."
|
||||
# type: master
|
||||
# notify: true
|
||||
# file: zones/external/db.local.example
|
||||
# - name: "internal"
|
||||
# match_clients:
|
||||
# - "!192.168.178.1"
|
||||
# - "internalnets"
|
||||
# - "127.0.0.0/8"
|
||||
# zones:
|
||||
# - config:
|
||||
# allow_notify: []
|
||||
# allow_query:
|
||||
# - "any"
|
||||
# allow_query_on: []
|
||||
# allow_update: []
|
||||
# allow_update_forwarding: []
|
||||
# allow_transfer: []
|
||||
# file: zones/internal/db.local.example
|
||||
# origin: "example.local."
|
||||
# type: master
|
||||
# file: zones/internal/db.local.example
|
||||
# - config:
|
||||
# allow_notify: []
|
||||
# allow_query: []
|
||||
# allow_query_on: []
|
||||
# allow_update: []
|
||||
# allow_update_forwarding: []
|
||||
# allow_transfer: []
|
||||
# forward: only
|
||||
# forwarders:
|
||||
# - 192.168.175.1
|
||||
# origin: "gitlab-runner.external.local"
|
||||
# type: forward
|
||||
# file: "gitlab-runner.external.local"
|
||||
@@ -1,93 +0,0 @@
|
||||
---
|
||||
|
||||
bind9_acls:
|
||||
- name: internalnets
|
||||
permissions: []
|
||||
# - "111.222.111.222"
|
||||
|
||||
bind9_logging:
|
||||
categories:
|
||||
- name: "security"
|
||||
channels:
|
||||
- "security_file"
|
||||
channels:
|
||||
- name: "security_file"
|
||||
file:
|
||||
path: "/var/log/named/security.log"
|
||||
options: "versions 3 size 30m"
|
||||
severity: "dynamic"
|
||||
print_times: "yes"
|
||||
|
||||
bind9_options:
|
||||
allow_query: []
|
||||
allow_query_on: []
|
||||
allow_query_cache: []
|
||||
allow_query_cache_on: []
|
||||
allow_recursion:
|
||||
- "localhost"
|
||||
- "localnets"
|
||||
- "internalnets"
|
||||
allow_recursion_on: []
|
||||
allow_transfer: []
|
||||
allow_update: []
|
||||
allow_update_forwarding: []
|
||||
auth_nxdomain: false
|
||||
blackhole: []
|
||||
dnssec_validations: true
|
||||
forwarders:
|
||||
- "8.8.8.8" # Google IPv4
|
||||
- "8.8.4.4" # Google IPv4
|
||||
- "2001:4860:4860::8888" # Google IPv6
|
||||
- "2001:4860:4860::8844" # Google IPv6
|
||||
- "208.67.222.222" # OpenDNS IPv4
|
||||
- "208.67.220.220" # OpenDNS IPv4
|
||||
- "2620:0:ccc::2" # OpenDNS IPv6
|
||||
- "2620:0:ccd::2" # OpenDNS IPv6
|
||||
interface_interval: 0
|
||||
listen_on_ipv4:
|
||||
- "127.0.0.1"
|
||||
listen_on_ipv6:
|
||||
- "::1"
|
||||
max_transfer_time: "60"
|
||||
minimal_responses: "no"
|
||||
notify: "yes"
|
||||
recursion: "yes"
|
||||
transfer_format: "many-answers"
|
||||
|
||||
bind9_tsigkeys: []
|
||||
# - name: "name"
|
||||
# algorithm: "algorithm"
|
||||
# secret: "secret"
|
||||
|
||||
bind9_views: []
|
||||
# - name: external
|
||||
# match_clients:
|
||||
# - "!internalnets"
|
||||
# - "any"
|
||||
# zones:
|
||||
# - allow_notify: []
|
||||
# allow_query:
|
||||
# - "any"
|
||||
# allow_query_on: []
|
||||
# allow_update: []
|
||||
# allow_update_forwarding: []
|
||||
# allow_transfer: []
|
||||
# file: zones/external/db.local.example
|
||||
# origin: "example.local."
|
||||
# type: master
|
||||
# - name: internal
|
||||
# match_clients:
|
||||
# - "!192.168.178.1"
|
||||
# - "internalnets"
|
||||
# - "127.0.0.0/8"
|
||||
# zones:
|
||||
# - allow_notify: []
|
||||
# allow_query:
|
||||
# - "any"
|
||||
# allow_query_on: []
|
||||
# allow_update: []
|
||||
# allow_update_forwarding: []
|
||||
# allow_transfer: []
|
||||
# file: zones/internal/db.local.example
|
||||
# origin: "example.local."
|
||||
# type: master
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Restart named
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ bind9_service_name }}"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
|
||||
- name: restart named
|
||||
systemd:
|
||||
name: "{{ bind_service_name }}"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
@@ -1,24 +1,26 @@
|
||||
dependencies: []
|
||||
galaxy_info:
|
||||
role_name: bind9
|
||||
author: Markus Pesch
|
||||
description: Role to install and configure bind9 on different distributions
|
||||
company: Cryptic Systems
|
||||
description: Role to install and configure bind9 on different distributions
|
||||
galaxy_tags:
|
||||
- named
|
||||
- bind
|
||||
- dyndns
|
||||
license: MIT
|
||||
min_ansible_version: "2.9"
|
||||
namespace: volker-raschek
|
||||
platforms:
|
||||
- name: ArchLinux
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
|
||||
galaxy_tags:
|
||||
- named
|
||||
- bind
|
||||
- dyndns
|
||||
|
||||
dependencies: []
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
role_name: bind9
|
||||
@@ -0,0 +1,17 @@
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ENV container=docker
|
||||
|
||||
RUN if command -v pacman > /dev/null; then \
|
||||
pacman --sync --refresh --noconfirm systemd systemd-sysvcompat python; \
|
||||
elif command -v apt-get > /dev/null; then \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --yes systemd systemd-sysv python3 python3-apt; \
|
||||
else \
|
||||
dnf install --assumeyes systemd python3 python3-libdnf5 && \
|
||||
dnf clean all; \
|
||||
fi
|
||||
|
||||
STOPSIGNAL SIGRTMIN+3
|
||||
CMD ["/sbin/init"]
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
collections:
|
||||
- name: community.docker
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
bind9_systemd_dropin: |
|
||||
[Service]
|
||||
Environment=MOLECULE_BIND9_DROPIN=present
|
||||
tasks:
|
||||
- name: Include the role bind9
|
||||
ansible.builtin.include_role:
|
||||
name: bind9
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
|
||||
- name: Create
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Build systemd-enabled test images
|
||||
community.docker.docker_image:
|
||||
name: "bind9-molecule-{{ item.name }}:latest"
|
||||
source: build
|
||||
build:
|
||||
path: "{{ molecule_scenario_directory }}"
|
||||
args:
|
||||
BASE_IMAGE: "{{ item.image }}"
|
||||
loop: "{{ molecule_yml.platforms }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Start a systemd container per platform
|
||||
community.docker.docker_container:
|
||||
name: "{{ item.name }}"
|
||||
image: "bind9-molecule-{{ item.name }}:latest"
|
||||
command: /sbin/init
|
||||
state: started
|
||||
privileged: true
|
||||
cgroupns_mode: host
|
||||
tmpfs:
|
||||
- /run
|
||||
- /run/lock
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
loop: "{{ molecule_yml.platforms }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Write the instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{% for platform in molecule_yml.platforms %}
|
||||
- instance: {{ platform.name }}
|
||||
connection: community.docker.docker
|
||||
{% endfor %}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Destroy
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Remove the container of every platform
|
||||
community.docker.docker_container:
|
||||
name: "{{ item.name }}"
|
||||
state: absent
|
||||
loop: "{{ molecule_yml.platforms }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Remove the test image of every platform
|
||||
community.docker.docker_image:
|
||||
name: "bind9-molecule-{{ item.name }}:latest"
|
||||
state: absent
|
||||
loop: "{{ molecule_yml.platforms }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
|
||||
- name: Empty the instance config
|
||||
ansible.builtin.copy:
|
||||
content: "[]"
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
driver:
|
||||
name: default
|
||||
options:
|
||||
managed: true
|
||||
login_cmd_template: "docker exec --interactive --tty {instance} bash"
|
||||
|
||||
platforms:
|
||||
- name: bind9-archlinux
|
||||
image: docker.io/library/archlinux:base
|
||||
- name: bind9-debian
|
||||
image: docker.io/library/debian:13
|
||||
- name: bind9-fedora
|
||||
image: registry.fedoraproject.org/fedora:43
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
env:
|
||||
ANSIBLE_ROLES_PATH: "${MOLECULE_PROJECT_DIRECTORY}/.."
|
||||
config_options:
|
||||
defaults:
|
||||
interpreter_python: auto_silent
|
||||
|
||||
scenario:
|
||||
test_sequence:
|
||||
- dependency
|
||||
- cleanup
|
||||
- destroy
|
||||
- syntax
|
||||
- create
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
- cleanup
|
||||
- destroy
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Create the parent directory for DNSSEC keys
|
||||
ansible.builtin.file:
|
||||
path: /var/named
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
state: directory
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
# The role has no role dependencies, but molecule warns about the missing file.
|
||||
roles: []
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
|
||||
- name: Verify
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Validate the generated BIND configuration
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- named-checkconf
|
||||
- "{{ '/etc/bind/named.conf' if ansible_facts['os_family'] == 'Debian' else '/etc/named.conf' }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Gather service states
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
- name: Assert that named is active
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_facts.services['named.service'].state == 'running'
|
||||
|
||||
- name: Read the systemd drop-in
|
||||
ansible.builtin.slurp:
|
||||
src: /etc/systemd/system/named.service.d/override.conf
|
||||
register: _bind9_systemd_dropin
|
||||
|
||||
- name: Assert that the configured systemd drop-in was installed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'Environment=MOLECULE_BIND9_DROPIN=present' in (_bind9_systemd_dropin.content | b64decode)"
|
||||
+7
-15
@@ -1,17 +1,9 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"assignees": [ "volker.raschek" ],
|
||||
"automergeStrategy": "merge-commit",
|
||||
"automergeType": "pr",
|
||||
"labels": [ "renovate" ],
|
||||
"packageRules": [
|
||||
{
|
||||
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
|
||||
"automerge": true,
|
||||
"matchManagers": "droneci",
|
||||
"matchUpdateTypes": [ "minor", "patch"]
|
||||
}
|
||||
],
|
||||
"rebaseLabel": "renovate/rebase",
|
||||
"rebaseWhen": "behind-base-branch"
|
||||
}
|
||||
"extends": [
|
||||
"local>volker.raschek/renovate-config:default#master",
|
||||
"local>volker.raschek/renovate-config:container#master",
|
||||
"local>volker.raschek/renovate-config:actions#master",
|
||||
"local>volker.raschek/renovate-config:regexp#master"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: "Create private DNSSEC: {{ bind9_dnssec_key.origin }}"
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ item.private.filename }}"
|
||||
content: "{{ item.private.content }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
with_items:
|
||||
- "{{ bind9_dnssec_key.key_signing_key }}"
|
||||
- "{{ bind9_dnssec_key.zone_signing_key }}"
|
||||
|
||||
- name: "Create public DNSSEC: {{ bind9_dnssec_key.origin }}"
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ item.public.filename }}"
|
||||
content: "{{ item.public.content }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0644"
|
||||
no_log: true
|
||||
with_items:
|
||||
- "{{ bind9_dnssec_key.key_signing_key }}"
|
||||
- "{{ bind9_dnssec_key.zone_signing_key }}"
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
---
|
||||
|
||||
- name: Include OS-specific variables
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
vars:
|
||||
params:
|
||||
files:
|
||||
- "{{ ansible_facts['distribution'] }}_{{ ansible_facts['architecture'] }}.yaml"
|
||||
- "{{ ansible_facts['distribution'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}_{{ ansible_facts['architecture'] }}.yaml"
|
||||
- "{{ ansible_facts['os_family'] }}.yaml"
|
||||
- main.yaml
|
||||
paths:
|
||||
- vars
|
||||
|
||||
- name: Install bind and dependencies
|
||||
ansible.builtin.package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ bind9_package_names }}"
|
||||
|
||||
- name: Create logging directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_log_directory }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0755"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
- name: Create config directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_config_directory }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0755"
|
||||
state: directory
|
||||
recurse: true
|
||||
|
||||
- name: Remove existing journal files
|
||||
block:
|
||||
- name: Find existing journal files
|
||||
ansible.builtin.find:
|
||||
path: "{{ bind9_config_directory }}"
|
||||
recurse: true
|
||||
patterns: "*.jnl"
|
||||
register: files_to_delete
|
||||
- name: Delete existing journal files
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ files_to_delete.files }}"
|
||||
|
||||
- name: Remove existing signed zone files
|
||||
block:
|
||||
- name: Find existing signed zone files
|
||||
ansible.builtin.find:
|
||||
path: "{{ bind9_config_directory }}"
|
||||
recurse: true
|
||||
patterns: "*.signed"
|
||||
register: files_to_delete
|
||||
- name: Delete existing signed zone files
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ files_to_delete.files }}"
|
||||
|
||||
- name: Remove existing DNSSEC key directory
|
||||
block:
|
||||
- name: Check if DNSSEC key directory exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ bind9_options.key_directory }}"
|
||||
register: _stat_bind9_options_key_directory
|
||||
- name: Remove DNSSEC key directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_options.key_directory }}"
|
||||
state: "absent"
|
||||
when: _stat_bind9_options_key_directory.stat.exists
|
||||
|
||||
- name: Create DNSSEC key directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_options.key_directory }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0700"
|
||||
state: directory
|
||||
|
||||
- name: Create DNSSEC files
|
||||
ansible.builtin.include_tasks: create_dnssec_files.yaml
|
||||
with_items: "{{ bind9_dnssec_keys }}"
|
||||
no_log: true
|
||||
loop_control:
|
||||
loop_var: bind9_dnssec_key
|
||||
|
||||
- name: Create DNS-Zone files
|
||||
ansible.builtin.include_tasks: template_zone_files.yaml
|
||||
with_items:
|
||||
- "{{ bind9_views }}"
|
||||
loop_control:
|
||||
loop_var: view
|
||||
|
||||
- name: Create main configuration file
|
||||
ansible.builtin.template:
|
||||
src: "etc/named.conf.j2"
|
||||
dest: "{{ bind9_main_config }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0644"
|
||||
notify: Restart named
|
||||
|
||||
- name: Create excluded configuration files
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ item | replace('etc/named', bind9_config_directory) }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0644"
|
||||
with_items:
|
||||
- etc/named.conf
|
||||
- etc/named/named.conf.acl
|
||||
- etc/named/named.conf.logging
|
||||
- etc/named/named.conf.options
|
||||
- etc/named/named.conf.tsigkeys
|
||||
- etc/named/named.conf.views
|
||||
notify: Restart named
|
||||
|
||||
- name: Create systemd drop-in
|
||||
when: bind9_systemd_dropin | default('', true) | length > 0
|
||||
block:
|
||||
- name: Create systemd drop-in directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_systemd_dropin_dir }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
state: "directory"
|
||||
- name: Template systemd drop-in
|
||||
ansible.builtin.template:
|
||||
src: etc/systemd/system/named.service.d/override.conf.j2
|
||||
dest: "{{ bind9_systemd_dropin_dir }}/override.conf"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
register: _bind9_systemd_drop_in
|
||||
- name: Systemd reload # noqa: no-handler
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
when: _bind9_systemd_drop_in.changed
|
||||
|
||||
- name: Remove systemd drop-in
|
||||
when: bind9_systemd_dropin | default('', true) | length == 0
|
||||
block:
|
||||
- name: Remove systemd drop-in file
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_systemd_dropin_dir }}/override.conf"
|
||||
state: "absent"
|
||||
register: _bind9_systemd_drop_in
|
||||
- name: Systemd reload # noqa: no-handler
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
when: _bind9_systemd_drop_in.changed
|
||||
|
||||
- name: Start and enabled named
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ bind9_service_name }}"
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Create rndc.key
|
||||
ansible.builtin.template:
|
||||
src: etc/rndc.key.j2
|
||||
dest: /etc/rndc.key
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0600"
|
||||
when: bind9_rndc_key.name | length > 0 and
|
||||
bind9_rndc_key.algorithm | length > 0 and
|
||||
bind9_rndc_key.secret | length > 0
|
||||
@@ -1,88 +0,0 @@
|
||||
---
|
||||
|
||||
- name: Include special distribution-dependent variables
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Install bind and dependencies
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items: "{{ bind_package_names }}"
|
||||
|
||||
- name: Create logging directory
|
||||
file:
|
||||
path: "{{ bind_log_directory }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0755
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Create config directory
|
||||
file:
|
||||
path: "{{ bind_config_directory }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0755
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Remove existing journal files
|
||||
block:
|
||||
- name: find existing journal files
|
||||
find:
|
||||
path: "{{ bind_config_directory }}"
|
||||
recurse: yes
|
||||
patterns: "*.jnl"
|
||||
register: files_to_delete
|
||||
- name: delete existing journal files
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{ files_to_delete.files }}"
|
||||
|
||||
|
||||
# - name: copy zone files
|
||||
# include_tasks: copy_zone_files.yml
|
||||
# with_items:
|
||||
# - "{{ bind9_views }}"
|
||||
# loop_control:
|
||||
# loop_var: view
|
||||
|
||||
- name: Create DNS-Zone files
|
||||
include_tasks: template_zone_files.yml
|
||||
with_items:
|
||||
- "{{ bind9_views }}"
|
||||
loop_control:
|
||||
loop_var: view
|
||||
|
||||
- name: Create main configuration file
|
||||
template:
|
||||
src: "etc/named.conf.j2"
|
||||
dest: "{{ bind_main_config }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0644
|
||||
notify: restart named
|
||||
|
||||
- name: Create excluded configuration files
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ item | replace('etc/named', bind_config_directory) }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- etc/named.conf
|
||||
- etc/named/named.conf.acl
|
||||
- etc/named/named.conf.logging
|
||||
- etc/named/named.conf.options
|
||||
- etc/named/named.conf.tsigkeys
|
||||
- etc/named/named.conf.views
|
||||
notify: restart named
|
||||
|
||||
- name: Start and enabled named
|
||||
systemd:
|
||||
name: named
|
||||
state: started
|
||||
enabled: yes
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
|
||||
- name: "Sign DNS Zone {{ zone.config.origin }}"
|
||||
vars:
|
||||
dnssec_cmd:
|
||||
- dnssec-signzone
|
||||
- -N
|
||||
- INCREMENT
|
||||
- -S
|
||||
- -K
|
||||
- "{{ bind9_options.key_directory }}"
|
||||
block:
|
||||
- name: "Extend dnssec command of ORIGIN"
|
||||
ansible.builtin.set_fact:
|
||||
_dnssec_cmd: "{{ dnssec_cmd + ['-o', zone.config.origin] }}"
|
||||
- name: "Extend dnssec command of zone file"
|
||||
ansible.builtin.set_fact:
|
||||
_dnssec_cmd: "{{ _dnssec_cmd + [bind9_config_directory + '/' + zone.file] }}"
|
||||
- name: "Sign zone {{ zone.config.origin }}"
|
||||
ansible.builtin.command:
|
||||
argv: "{{ _dnssec_cmd }}"
|
||||
creates: "{{ bind9_config_directory + '/' + zone.file }}.signed"
|
||||
- name: Adapt signed zone file permissions
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_config_directory + '/' + zone.file }}.signed"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0644"
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
|
||||
- name: "Create config directory of DNS zones"
|
||||
ansible.builtin.file:
|
||||
path: "{{ bind9_config_directory }}/{{ zone.file | dirname }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0755"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.file is defined and
|
||||
zone.file | length > 0
|
||||
|
||||
- name: "Template view {{ view.name }}"
|
||||
ansible.builtin.template:
|
||||
src: "{{ inventory_hostname }}/etc/named/{{ zone.file }}.j2"
|
||||
dest: "{{ bind9_config_directory + '/' + zone.file }}"
|
||||
owner: "{{ bind9_unix_user }}"
|
||||
group: "{{ bind9_unix_group }}"
|
||||
mode: "0644"
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.config.type == 'master'
|
||||
notify: Restart named
|
||||
|
||||
- name: Check if last character in zone files is a newline
|
||||
ansible.builtin.include_tasks: verify_zone_file.yaml
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.config.type == 'master'
|
||||
|
||||
- name: Sign Zones
|
||||
ansible.builtin.include_tasks: sign_zone_file.yaml
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.config.type == 'master' and
|
||||
bind9_dnssec_keys | selectattr('origin', 'in', zone.config.origin) | map(attribute='zone_signing_key') | length > 0 and
|
||||
(bind9_dnssec_keys | selectattr('origin', 'in', zone.config.origin) | map(attribute='zone_signing_key'))[0].private | length > 0 and
|
||||
(bind9_dnssec_keys | selectattr('origin', 'in', zone.config.origin) | map(attribute='zone_signing_key'))[0].public | length > 0
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
|
||||
- name: create directory for zone {{ zone.file | dirname }}
|
||||
file:
|
||||
path: "{{ bind_config_directory }}/{{ zone.file | dirname }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0755
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
|
||||
- name: "template view {{ view.name }}"
|
||||
template:
|
||||
src: "{{ inventory_hostname }}/etc/named/{{ zone.file }}.j2"
|
||||
dest: "{{ bind_config_directory }}/{{ zone.file }}"
|
||||
owner: "{{ bind_unix_user }}"
|
||||
group: "{{ bind_unix_group }}"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ view.zones }}"
|
||||
loop_control:
|
||||
loop_var: zone
|
||||
when: zone.type == 'master'
|
||||
notify: restart named
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: "Read the last character of DNS zone: {{ zone.config.origin }}"
|
||||
ansible.builtin.command:
|
||||
cmd: "tail --bytes 1 {{ bind9_config_directory + '/' + zone.file }}"
|
||||
register: _bind9_zone_last_character
|
||||
changed_when: _bind9_zone_last_character.rc == 0
|
||||
failed_when: _bind9_zone_last_character.rc > 0
|
||||
|
||||
- name: "Fail when the last character of DNS zone file is not a newline: {{ bind9_config_directory + '/' + zone.file }}"
|
||||
ansible.builtin.fail:
|
||||
msg: "Last character of DNS zone file is not a newline: {{ bind9_config_directory + '/' + zone.file }}"
|
||||
when: _bind9_zone_last_character.stdout != ''
|
||||
@@ -7,8 +7,8 @@
|
||||
# file "named.ca";
|
||||
# };
|
||||
|
||||
include "{{ bind_config_directory }}/named.conf.acl";
|
||||
include "{{ bind_config_directory }}/named.conf.logging";
|
||||
include "{{ bind_config_directory }}/named.conf.options";
|
||||
include "{{ bind_config_directory }}/named.conf.tsigkeys";
|
||||
include "{{ bind_config_directory }}/named.conf.views";
|
||||
include "{{ bind9_config_directory }}/named.conf.acl";
|
||||
include "{{ bind9_config_directory }}/named.conf.logging";
|
||||
include "{{ bind9_config_directory }}/named.conf.options";
|
||||
include "{{ bind9_config_directory }}/named.conf.tsigkeys";
|
||||
include "{{ bind9_config_directory }}/named.conf.views";
|
||||
@@ -2,6 +2,23 @@
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
|
||||
{% if bind9_controls is defined and bind9_controls | length > 0 %}
|
||||
controls {
|
||||
{% for control in bind9_controls %}
|
||||
inet {{ control.inet }} port {{ control.port }} allow {
|
||||
{% for acl in control.acls %}
|
||||
{{ acl }};
|
||||
{% endfor %}
|
||||
} keys {
|
||||
{% for name in control.tsig_keys %}
|
||||
"{{ name }}";
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
{% endfor %}
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
options {
|
||||
|
||||
# This specifies which hosts are allowed to ask ordinary DNS questions.
|
||||
@@ -167,16 +184,35 @@ options {
|
||||
# allow-update-forwarding {};
|
||||
{% endif %}
|
||||
|
||||
directory "{{ bind_config_directory }}";
|
||||
directory "{{ bind9_config_directory }}";
|
||||
|
||||
dnssec-validation {{ bind9_options.dnssec_validation | default('no') }};
|
||||
# This accepts expired signatures when verifying DNSSEC signatures. The default is no. Setting this option to yes
|
||||
# leaves named vulnerable to replay attacks.
|
||||
dnssec-accept-expired {{ "yes" if bind9_options.dnssec_accept_expired else "no" }};
|
||||
|
||||
# dump-file "/var/bind/named.dump";
|
||||
# Enables DNSSEC validation in named.
|
||||
#
|
||||
# auto: If set to auto, DNSSEC validation is enabled and a default trust anchor for the DNS root zone is used. This
|
||||
# trust anchor is provided as part of BIND and is kept up-to-date
|
||||
#
|
||||
# yes: If set to yes, DNSSEC validation is enabled, but a trust anchor must be manually configured using a
|
||||
# trust-anchors statement (or the managed-keys or trusted-keys statements, both deprecated). If trust-anchors is not
|
||||
# configured, it is a configuration error. If trust-anchors does not include a valid root key, then validation does
|
||||
# not take place for names which are not covered by any of the configured trust anchors.
|
||||
#
|
||||
# no: If set to no, DNSSEC validation is disabled.
|
||||
#
|
||||
# https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-dnssec-validation
|
||||
dnssec-validation {{ bind9_options.dnssec_validation | default('auto') }};
|
||||
|
||||
{% if bind9_options.forwarders is defined and bind9_options.forwarders | length > 0 %}
|
||||
forwarders {
|
||||
{% for forwarder in bind9_options.forwarders %}
|
||||
{{ forwarder }};
|
||||
{% if forwarder.port is defined and forwarder.port | length > 0 %}
|
||||
{{ forwarder.ip }} port {{ forwarder.port }};
|
||||
{% else %}
|
||||
{{ forwarder.ip }};
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
};
|
||||
{% else %}
|
||||
@@ -210,6 +246,13 @@ options {
|
||||
};
|
||||
{% endif %}
|
||||
|
||||
# Indicates the directory where public and private DNSSEC key files are found.
|
||||
#
|
||||
# This is the directory where the public and private DNSSEC key files should be found when performing a dynamic update
|
||||
# of secure zones, if different than the current working directory.
|
||||
# https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-key-directory
|
||||
key-directory "{{ bind9_options.key_directory }}";
|
||||
|
||||
# managed-keys-directory "/var/named/dynamic";
|
||||
# memstatistics-file "/var/bind/named.memstats";
|
||||
minimal-responses {{ bind9_options.minimal_responses }};
|
||||
@@ -230,4 +273,16 @@ options {
|
||||
version none;
|
||||
|
||||
zone-statistics yes;
|
||||
};
|
||||
};
|
||||
|
||||
{% if bind9_statics.enabled is defined and bind9_statics.enabled is true %}
|
||||
statistics-channels {
|
||||
{% for channel in bind9_statics.channels %}
|
||||
inet {{ channel.inet }} port {{ channel.port }} allow {
|
||||
{% for acl in channel.acls %}
|
||||
{{ acl }};
|
||||
{% endfor %}
|
||||
};
|
||||
{% endfor %}
|
||||
};
|
||||
{% endif %}
|
||||
@@ -1,3 +1,4 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
@@ -12,7 +13,26 @@ view "{{ view.name }}" {
|
||||
};
|
||||
|
||||
{% for zone in view.zones %}
|
||||
zone "{{ zone.origin }}" {
|
||||
zone "{{ zone.config.origin }}" {
|
||||
|
||||
# allow-notify applies to slave zones only and defines a match list,
|
||||
# e.g. IP address(es), that are allowed to NOTIFY the slave in
|
||||
# addition to those hosts defined in the masters statement. By
|
||||
# default only the hosts of the masters statement may send NOTIFY
|
||||
# messages.
|
||||
#
|
||||
# NOTE:
|
||||
# - This statement may be used in a zone, view or a global options
|
||||
# clause.
|
||||
{% if zone.config.allow_notify is defined and zone.config.allow_notify | length > 0 %}
|
||||
allow-notify {
|
||||
{% for entry in zone.config.allow_notify %}
|
||||
{{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
{% else %}
|
||||
# allow-notify {};
|
||||
{% endif %}
|
||||
|
||||
# Hosts which are allowed to issue queries to the server. If not specified all
|
||||
# hosts are allowed to make queries (defaults to allow-query {any;};
|
||||
@@ -20,9 +40,9 @@ view "{{ view.name }}" {
|
||||
# NOTE:
|
||||
# - The statements may be used in a zone, view or a global options
|
||||
# clause.
|
||||
{% if zone.allow_query is defined and zone.allow_query | length > 0 %}
|
||||
{% if zone.config.allow_query is defined and zone.config.allow_query | length > 0 %}
|
||||
allow-query {
|
||||
{% for entry in zone.allow_query %}
|
||||
{% for entry in zone.config.allow_query %}
|
||||
{{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -39,9 +59,9 @@ view "{{ view.name }}" {
|
||||
# NOTE:
|
||||
# - The statements may be used in a zone, view or a global options
|
||||
# clause.
|
||||
{% if zone.allow_query_on is defined and zone.allow_query_on | length > 0 %}
|
||||
allow-query {
|
||||
{% for entry in zone.allow_query_on %}
|
||||
{% if zone.config.allow_query_on is defined and zone.config.allow_query_on | length > 0 %}
|
||||
allow-query-on {
|
||||
{% for entry in zone.config.allow_query_on %}
|
||||
{{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -62,9 +82,9 @@ view "{{ view.name }}" {
|
||||
#
|
||||
# NOTE:
|
||||
# - This statement may be used in a zone, view or global options clause.
|
||||
{% if zone.allow_transfer is defined and zone.allow_transfer | length > 0 %}
|
||||
{% if zone.config.allow_transfer is defined and zone.config.allow_transfer | length > 0 %}
|
||||
allow-transfer {
|
||||
{% for entry in zone.allow_transfer %}
|
||||
{% for entry in zone.config.allow_transfer %}
|
||||
key {{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -85,9 +105,9 @@ view "{{ view.name }}" {
|
||||
#
|
||||
# NOTE:
|
||||
# - This statement may be used in a zone, view or an options clause.
|
||||
{% if zone.allow_update is defined and zone.allow_update | length > 0 %}
|
||||
{% if zone.config.allow_update is defined and zone.config.allow_update | length > 0 %}
|
||||
allow-update {
|
||||
{% for entry in zone.allow_update %}
|
||||
{% for entry in zone.config.allow_update %}
|
||||
key {{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -101,9 +121,9 @@ view "{{ view.name }}" {
|
||||
#
|
||||
# NOTE:
|
||||
# - This statement may be used in zone, view or an options clause.
|
||||
{% if zone.allow_update_forwarding is defined and zone.allow_update_forwarding | length > 0 %}
|
||||
{% if zone.config.allow_update_forwarding is defined and zone.config.allow_update_forwarding | length > 0 %}
|
||||
allow-update-forwarding {
|
||||
{% for entry in zone.allow_update_forwarding %}
|
||||
{% for entry in zone.config.allow_update_forwarding %}
|
||||
{{ entry }};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -127,13 +147,45 @@ view "{{ view.name }}" {
|
||||
# is complete. If the Master is not available or the Slave fails to
|
||||
# contact the Master, ffor whatever reason, the zone may be left with
|
||||
# no effective Authoritative Name Servers.
|
||||
file "{{ bind_config_directory }}/{{ zone.file }}";
|
||||
{% if zone.file is defined and zone.file | length > 0 and not zone.file.startswith('/') %}
|
||||
file "{{ bind9_config_directory }}/{{ zone.config.file }}";
|
||||
{% elif zone.file is defined and zone.file | length > 0 and zone.file.startswith('/')%}
|
||||
file "{{ zone.config.file }}";
|
||||
{% else %}
|
||||
# file "{{ bind9_config_directory }}/...";
|
||||
{% endif %}
|
||||
|
||||
# This option is only meaningful if the forwarders list is not empty. A
|
||||
# value of first is the default and causes the server to query the
|
||||
# forwarders first; if that does not answer the question, the server then
|
||||
# looks for the answer itself. If only is specified, the server only queries
|
||||
# the forwarders.
|
||||
{% if zone.config.forward is defined and zone.config.forward | length > 0 %}
|
||||
forward {{ zone.config.forward }};
|
||||
{% else %}
|
||||
# forward first;
|
||||
{% endif %}
|
||||
|
||||
# This specifies a list of IP addresses to which queries are forwarded. The
|
||||
# default is the empty list (no forwarding). Each address in the list can be
|
||||
# associated with an optional port number and/or DSCP value, and a default
|
||||
# port number and DSCP value can be set for the entire list.
|
||||
# https://bind9.readthedocs.io/en/latest/reference.html#forwarding
|
||||
{% if zone.config.forwarders is defined and zone.config.forwarders | length > 0 %}
|
||||
forwarders {
|
||||
{% for forwarder in zone.config.forwarders %}
|
||||
{{ forwarder }};
|
||||
{% endfor %}
|
||||
};
|
||||
{% else %}
|
||||
# forwarders {};
|
||||
{% endif %}
|
||||
|
||||
# master servers
|
||||
# https://bind9.readthedocs.io/en/latest/manpages.html?highlight=masters#masters
|
||||
{% if zone.masters is defined and zone.masters | length > 0 %}
|
||||
{% if zone.config.masters is defined and zone.config.masters | length > 0 %}
|
||||
masters {
|
||||
{% for master in zone.masters %}
|
||||
{% for master in zone.config.masters %}
|
||||
{{ master.ip }} key {{ master.tsigkey}};
|
||||
{% endfor %}
|
||||
};
|
||||
@@ -157,7 +209,14 @@ view "{{ view.name }}" {
|
||||
# NOTE:
|
||||
# - This statement may be specified in zone, view clauses or in a
|
||||
# global options clause.
|
||||
{% if zone.config.notify is defined and zone.config.notify %}
|
||||
notify yes;
|
||||
{% elif zone.config.notify is defined and not zone.config.notify %}
|
||||
notify no;
|
||||
{% else %}
|
||||
# notify yes | no;
|
||||
{% endif %}
|
||||
|
||||
|
||||
# Zones configured for dynamic DNS may use this option to set the
|
||||
# update method to be used for the zone serial number in the SOA
|
||||
@@ -176,15 +235,32 @@ view "{{ view.name }}" {
|
||||
# is the current date in the form “YYYYMMDD”, followed by two
|
||||
# zeroes, unless the existing serial number is already greater than
|
||||
# or equal to that value, in which case it is incremented by one.
|
||||
{% if zone.serial_update_method is defined %}
|
||||
serial-update-method {{ zone.serial_update_method }};
|
||||
{% if zone.config.serial_update_method is defined %}
|
||||
serial-update-method {{ zone.config.serial_update_method }};
|
||||
{% else %}
|
||||
# serial-update-method [date | increment | unixtime ];
|
||||
{% endif %}
|
||||
|
||||
type {{ zone.type }};
|
||||
type {{ zone.config.type }};
|
||||
|
||||
# The update-policy clause allows more fine-grained control over which
|
||||
# updates are allowed. It specifies a set of rules, in which each rule
|
||||
# either grants or denies permission for one or more names in the zone to be
|
||||
# updated by one or more identities. Identity is determined by the key that
|
||||
# signed the update request, using either TSIG or SIG(0).
|
||||
# https://bind9.readthedocs.io/en/v9_16_5/reference.html#dynamic-update-policies
|
||||
{% if zone.config.update_policies is defined and zone.config.update_policies | length > 0 %}
|
||||
update-policy {
|
||||
{% for update_policy in zone.config.update_policies %}
|
||||
{{ update_policy.action }} {{ update_policy.identity }} {{ update_policy.ruletype }} {{ update_policy.name | default('') }} {{ update_policy.types | default('') | join(' ') }};
|
||||
{% endfor %}
|
||||
};
|
||||
{% else %}
|
||||
# update-policy {};
|
||||
{% endif %}
|
||||
|
||||
};
|
||||
|
||||
{% endfor %}
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
key "{{ bind9_rndc_key.name }}" {
|
||||
algorithm {{ bind9_rndc_key.algorithm }};
|
||||
secret "{{ bind9_rndc_key.secret }}";
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
{{ bind9_systemd_dropin }}
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
bind9_binary: /usr/bin/named
|
||||
|
||||
bind9_main_config: /etc/named.conf
|
||||
bind9_config_directory: /etc/named
|
||||
bind9_log_directory: /var/log/named
|
||||
|
||||
bind9_package_names:
|
||||
- bind
|
||||
|
||||
bind9_service_name: named
|
||||
bind9_systemd_dropin_dir: "/etc/systemd/system/{{ bind9_service_name }}.service.d"
|
||||
|
||||
bind9_unix_user: named
|
||||
bind9_unix_group: named
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
|
||||
bind_main_config: /etc/named.conf
|
||||
bind_config_directory: /etc/named
|
||||
bind_log_directory: /var/log/named
|
||||
|
||||
bind_package_names:
|
||||
- bind
|
||||
|
||||
bind_service_name: named
|
||||
|
||||
bind_unix_user: named
|
||||
bind_unix_group: named
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
bind9_binary: /usr/sbin/named
|
||||
|
||||
bind9_main_config: /etc/bind/named.conf
|
||||
bind9_config_directory: /etc/bind
|
||||
bind9_log_directory: /var/log/bind
|
||||
|
||||
bind9_package_names:
|
||||
- bind9
|
||||
|
||||
bind9_service_name: named
|
||||
bind9_systemd_dropin_dir: "/etc/systemd/system/{{ bind9_service_name }}.service.d"
|
||||
|
||||
bind9_unix_user: bind
|
||||
bind9_unix_group: bind
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
|
||||
bind_main_config: /etc/bind/named.conf
|
||||
bind_config_directory: /etc/bind
|
||||
bind_log_directory: /var/log/bind
|
||||
|
||||
bind_package_names:
|
||||
- bind9
|
||||
|
||||
bind_service_name: named
|
||||
|
||||
bind_unix_user: bind
|
||||
bind_unix_group: bind
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
bind9_binary: /usr/sbin/named
|
||||
|
||||
bind9_main_config: /etc/named.conf
|
||||
bind9_config_directory: /etc/named
|
||||
bind9_log_directory: /var/log/named
|
||||
|
||||
bind9_package_names:
|
||||
- bind
|
||||
- bind-utils # for dig and tsig-keygen and so on
|
||||
|
||||
bind9_service_name: named
|
||||
bind9_systemd_dropin_dir: "/etc/systemd/system/{{ bind9_service_name }}.service.d"
|
||||
|
||||
bind9_unix_user: named
|
||||
bind9_unix_group: named
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
|
||||
bind_main_config: /etc/named.conf
|
||||
bind_config_directory: /etc/named
|
||||
bind_log_directory: /var/log/named
|
||||
|
||||
bind_package_names:
|
||||
- bind
|
||||
- bind-utils # for dig and tsig-keygen and so on
|
||||
|
||||
bind_service_name: named
|
||||
|
||||
bind_unix_user: named
|
||||
bind_unix_group: named
|
||||
Reference in new issue
Block a user