Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 38feae3

Browse files
committedSep 6, 2024··
1 parent 631c19c commit 38feae3

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed
 

‎modules/dns/files/check-dns-zones.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/python3
2+
3+
# Loops over all zonefiles and passes them through named-checkzone
4+
# Exits with error if named-checkzone does
5+
# Checks are in local mode
6+
7+
import os
8+
import subprocess
9+
10+
dir = os.fsencode('/etc/bind/zones/')
11+
for file in os.listdir(dir):
12+
filename = os.fsdecode(file)
13+
subprocess.run(['/usr/bin/named-checkzone', '-i local', filename, f'/etc/bind/zones/{filename}'], check=True)

‎modules/dns/manifests/init.pp

+18-24
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
11
# dns
22
class dns {
3-
include prometheus::exporter::gdnsd
3+
# include prometheus::exporter::gdnsd
44

5-
package { 'gdnsd':
5+
package { 'bind9':
6+
ensure => installed,
7+
}
8+
package { 'bind9-utils':
69
ensure => installed,
710
}
811

912
git::clone { 'dns':
1013
ensure => latest,
11-
directory => '/etc/gdnsd',
14+
directory => '/etc/bind',
1215
origin => 'https://github.com/miraheze/dns',
1316
owner => 'root',
1417
group => 'root',
15-
before => Package['gdnsd'],
16-
notify => Exec['gdnsd-syntax'],
18+
before => Package['bind9'],
19+
notify => Exec['bind-syntax'],
1720
}
1821

19-
file { '/usr/share/GeoIP/GeoLite2-Country.mmdb':
22+
file { '/usr/local/bin/check-dns-zones':
2023
ensure => present,
21-
source => 'puppet:///private/geoip/GeoLite2-Country.mmdb',
22-
mode => '0444',
23-
notify => Exec['gdnsd-syntax'],
24+
owner => 'root',
25+
group => 'root',
26+
source => 'puppet:///modules/dns/check-dns-zones.py',
27+
mode => '0555',
2428
}
2529

26-
exec { 'gdnsd-syntax':
27-
command => '/usr/sbin/gdnsd checkconf',
28-
notify => Service['gdnsd'],
30+
exec { 'bind-syntax':
31+
command => '/usr/local/bin/check-dns-zones',
32+
notify => Service['named'],
2933
refreshonly => true,
3034
}
3135

32-
service { 'gdnsd':
36+
service { 'named':
3337
ensure => running,
3438
hasrestart => true,
3539
hasstatus => true,
36-
require => [ Package['gdnsd'], Exec['gdnsd-syntax'] ],
37-
}
38-
39-
file { '/usr/lib/nagios/plugins/check_gdnsd_datacenters':
40-
ensure => present,
41-
source => 'puppet:///modules/dns/check_gdnsd_datacenters.py',
42-
mode => '0755',
40+
require => [ Package['bind9'], Exec['bind-syntax'] ],
4341
}
4442

4543
if ( $facts['networking']['interfaces']['ens19'] and $facts['networking']['interfaces']['ens18'] ) {
@@ -57,8 +55,4 @@
5755
host => 'wikitide.net',
5856
},
5957
}
60-
61-
monitoring::nrpe { 'GDNSD Datacenters':
62-
command => '/usr/bin/sudo /usr/lib/nagios/plugins/check_gdnsd_datacenters'
63-
}
6458
}

0 commit comments

Comments
 (0)
Please sign in to comment.