Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
default => 'pdns-backend-mysql'
}

$package_sqlite = $::operatingsystem ? {
/(?i:centos|redhat|amazon)/ => 'pdns-backend-sqlite',
default => 'pdns-backend-sqlite'
}

$package_ldap = $::operatingsystem ? {
/(?i:centos|redhat|amazon)/ => 'pdns-backend-ldap',
default => 'pdns-backend-ldap'
Expand All @@ -46,6 +51,11 @@
default => '/etc/powerdns/pdns.d/pdns.local.gmysql.conf'
}

$sqlite_cfg_path = $::operatingsystem ? {
/(?i:centos|redhat|amazon)/ => '/etc/pdns/pdns.conf',
default => '/etc/powerdns/pdns.d/pdns.local.gsqlite3.conf'
}

$ldap_cfg_path = $::operatingsystem ? {
/(?i:centos|redhat|amazon)/ => '/etc/pdns/pdns.conf',
default => '/etc/powerdns/pdns.d/pdns.local.ldap.conf'
Expand Down
5 changes: 4 additions & 1 deletion manifests/recursor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# configs used into the template:
# forward_zones
# forward_zones_recurse
# allow_from
# local_address
# local_port
# log_common_errors
Expand All @@ -25,10 +26,12 @@
#
class powerdns::recursor(
$package = $powerdns::params::package_recursor,
$recursor_cfg_path = $powerdns::params::recursor_cfg_path,
$ensure = 'present',
$source = '',
$forward_zones = undef,
$forward_zones_recurse = undef,
$allow_from = undef,
$local_address = '127.0.0.1',
$local_port = '53',
$log_common_errors = 'yes',
Expand Down Expand Up @@ -60,7 +63,7 @@
source => $package_source
}

file { $powerdns::params::recursor_cfg_path:
file { $recursor_cfg_path:
ensure => $ensure,
owner => root,
group => root,
Expand Down
49 changes: 49 additions & 0 deletions manifests/sqlite.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Public: Install the powerdns sqlite backend
#
# package - which package to install
# ensure - ensure mysql backend to be present or absent
# source - where to get the package from
# user - which user powerdns should connect as
# password - which password to use with user
# host - host to connect to
# port - port to connect to
# dbname - which database to use
# dnssec - enable or disable dnssec either yes or no
#
class powerdns::sqlite(
$package = $powerdns::params::package_sqlite,
$ensure = 'present',
$source = '',
$dnssec = 'yes',
$database_path = "/etc/pdns/pdns.db",
$sqlite_synchronous = 'off',
) inherits powerdns::params {

$package_source = $source ? {
'' => undef,
default => $source
}

$package_provider = $source ? {
'' => undef,
default => $powerdns::params::package_provider
}

package { $package:
ensure => $ensure,
require => Package[$powerdns::params::package],
provider => $package_provider,
source => $package_source
}

file { $powerdns::params::sqlite_cfg_path:
ensure => $ensure,
owner => root,
group => root,
mode => '0600',
backup => '.bak',
content => template('powerdns/pdns.sqlite.local.erb'),
notify => Service['pdns'],
require => Package[$powerdns::params::package],
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antonlindstrom-powerdns",
"version": "0.0.5",
"version": "0.0.6",
"author": "Anton Lindstrom",
"summary": "Module for managing PowerDNS",
"license": "GPLv2",
Expand Down
1 change: 1 addition & 0 deletions templates/pdns.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= $cfg_include_name %>=<%= $cfg_include_path %>
20 changes: 20 additions & 0 deletions templates/pdns.sqlite.local.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SQLite Configuration
#
# Managed by Puppet
#
# Launch gmysql backend
launch=gsqlite3

# gsqlite3 parameters
gsqlite3-database=<%= @database_path %>

<% if @synchronous %>
gsqlite3-pragma-synchronous=<%= @synchronous %>
<% end %>

gsqlite3-dnssec=<%= @dnssec %>

<% if @osfamily == "RedHat" %>
<%= @cfg_include_name %>=<%= @cfg_include_path %>
<% end %>

3 changes: 3 additions & 0 deletions templates/recursor.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# allow-from If set, only allow these comma separated netmasks to recurse
#
# allow-from=127.0.0.0/8, 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, ::1/128, fe80::/10
<%- if @allow_from -%>
allow-from=<%= @allow_from.join(',') %>
<%- end -%>

#################################
# allow-from-file If set, load allowed netmasks from this file
Expand Down