Skip to content

Commit

Permalink
Merge pull request #151 from bastelfreak/fixtures
Browse files Browse the repository at this point in the history
.fixtures.yml: Migrate to git
  • Loading branch information
ju5t authored Aug 22, 2023
2 parents 0623f38 + 341ff74 commit 457b065
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 162 deletions.
40 changes: 10 additions & 30 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
---
fixtures:
forge_modules:
epel:
repo: "puppet/epel"
ref: "3.0.1"
stdlib:
repo: "puppetlabs/stdlib"
ref: "9.3.0"
mysql:
repo: "puppetlabs/mysql"
ref: "15.0.0"
postgresql:
repo: "puppetlabs/postgresql"
ref: "9.1.0"
concat:
repo: "puppetlabs/concat"
ref: "5.3.0"
apt:
repo: "puppetlabs/apt"
ref: "6.3.0"
yumrepo:
repo: "puppetlabs/yumrepo_core"
puppet_version: ">= 6.0.0"
ref: "1.0.3"
augeas:
repo: "puppetlabs/augeas_core"
puppet_version: ">= 6.0.0"
ref: "1.0.4"
repositories:
systemd: 'https://github.com/voxpupuli/puppet-systemd'
symlinks:
powerdns: "#{source_dir}"
concat: https://github.com/puppetlabs/puppetlabs-concat.git
stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git
epel: https://github.com/voxpupuli/puppet-epel.git
mysql: https://github.com/puppetlabs/puppetlabs-mysql.git
postgresql: https://github.com/puppetlabs/puppetlabs-postgresql.git
apt: https://github.com/puppetlabs/puppetlabs-apt.git
systemd: https://github.com/voxpupuli/puppet-systemd
yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
augeas_core: https://github.com/puppetlabs/puppetlabs-augeas_core.git
16 changes: 8 additions & 8 deletions manifests/authoritative.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
class powerdns::authoritative (
$package_ensure = $powerdns::params::default_package_ensure,
Optional[Array[String]] $install_packages = $powerdns::install_packages,
) inherits powerdns {
) inherits powerdns {
# install the powerdns package
package { $::powerdns::params::authoritative_package:
package { $powerdns::params::authoritative_package:
ensure => $package_ensure,
}

stdlib::ensure_packages($install_packages)

# install the right backend
case $::powerdns::backend {
case $powerdns::backend {
'mysql': {
include powerdns::backends::mysql
}
Expand All @@ -28,14 +28,14 @@
include powerdns::backends::sqlite
}
default: {
fail("${::powerdns::backend} is not supported. We only support 'mysql', 'bind', 'postgresql', 'ldap' and 'sqlite' at the moment.")
fail("${powerdns::backend} is not supported. We only support 'mysql', 'bind', 'postgresql', 'ldap' and 'sqlite' at the moment.")
}
}

service { 'pdns':
ensure => running,
name => $::powerdns::params::authoritative_service,
enable => true,
require => Package[$::powerdns::params::authoritative_package],
ensure => running,
name => $powerdns::params::authoritative_service,
enable => true,
require => Package[$powerdns::params::authoritative_package],
}
}
22 changes: 11 additions & 11 deletions manifests/backends/bind.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Remove the default simplebind configuration as we prefer to manage PowerDNS
# consistently across all operating systems. This file is added to Debian
# based systems due to Debian's policies.
file { "${::powerdns::params::authoritative_configdir}/pdns.d/pdns.simplebind.conf":
file { "${powerdns::params::authoritative_configdir}/pdns.d/pdns.simplebind.conf":
ensure => absent,
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}

# set the configuration variables
Expand All @@ -19,33 +19,33 @@
powerdns::config { 'bind-config':
ensure => present,
setting => 'bind-config',
value => "${::powerdns::params::authoritative_configdir}/named.conf",
value => "${powerdns::params::authoritative_configdir}/named.conf",
type => 'authoritative',
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}

file { "${::powerdns::params::authoritative_configdir}/named.conf":
file { "${powerdns::params::authoritative_configdir}/named.conf":
ensure => file,
mode => '0644',
owner => 'root',
group => 'root',
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}

file_line { 'powerdns-bind-baseconfig':
ensure => present,
path => "${::powerdns::params::authoritative_configdir}/named.conf",
line => "options { directory \"${::powerdns::params::authoritative_configdir}/named\"; };",
path => "${powerdns::params::authoritative_configdir}/named.conf",
line => "options { directory \"${powerdns::params::authoritative_configdir}/named\"; };",
match => 'options',
notify => Service['pdns'],
require => File["${::powerdns::params::authoritative_configdir}/named.conf"],
require => File["${powerdns::params::authoritative_configdir}/named.conf"],
}

file { "${::powerdns::params::authoritative_configdir}/named":
file { "${powerdns::params::authoritative_configdir}/named":
ensure => directory,
mode => '0755',
owner => 'root',
group => 'root',
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}
}
26 changes: 13 additions & 13 deletions manifests/backends/ldap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# backend package which we do not want when using another backend such as ldap.
package { 'pdns-backend-bind':
ensure => purged,
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}
}

Expand All @@ -20,20 +20,20 @@
powerdns::config { 'ldap-host':
ensure => present,
setting => 'ldap-host',
value => $::powerdns::ldap_host,
value => $powerdns::ldap_host,
type => 'authoritative',
}

powerdns::config { 'ldap-binddn':
ensure => present,
setting => 'ldap-binddn',
value => $::powerdns::ldap_binddn,
value => $powerdns::ldap_binddn,
type => 'authoritative',
}

$_ldap_secret = $::powerdns::ldap_secret =~ Sensitive ? {
true => $::powerdns::ldap_secret.unwrap,
false => $::powerdns::ldap_secret
$_ldap_secret = $powerdns::ldap_secret =~ Sensitive ? {
true => $powerdns::ldap_secret.unwrap,
false => $powerdns::ldap_secret
}

powerdns::config { 'ldap-secret':
Expand All @@ -46,31 +46,31 @@
powerdns::config { 'ldap-basedn':
ensure => present,
setting => 'ldap-basedn',
value => $::powerdns::ldap_basedn,
value => $powerdns::ldap_basedn,
type => 'authoritative',
}

powerdns::config { 'ldap-method':
ensure => present,
setting => 'ldap-method',
value => $::powerdns::ldap_method,
value => $powerdns::ldap_method,
type => 'authoritative',
}

if $::powerdns::params::ldap_backend_package_name {
if $powerdns::params::ldap_backend_package_name {
# set up the powerdns backend
package { $::powerdns::params::ldap_backend_package_name:
package { $powerdns::params::ldap_backend_package_name:
ensure => $package_ensure,
before => Service['pdns'],
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}
}

if $::powerdns::backend_install {
if $powerdns::backend_install {
fail('backend_install is not supported with ldap')
}

if $::powerdns::backend_create_tables {
if $powerdns::backend_create_tables {
fail('backend_create_tables is not supported with ldap')
}
}
38 changes: 19 additions & 19 deletions manifests/backends/mysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
powerdns::config { 'gmysql-host':
ensure => present,
setting => 'gmysql-host',
value => $::powerdns::db_host,
value => $powerdns::db_host,
type => 'authoritative',
}

powerdns::config { 'gmysql-port':
ensure => present,
setting => 'gmysql-port',
value => $::powerdns::db_port,
value => $powerdns::db_port,
type => 'authoritative',
}

powerdns::config { 'gmysql-user':
ensure => present,
setting => 'gmysql-user',
value => $::powerdns::db_username,
value => $powerdns::db_username,
type => 'authoritative',
}

Expand All @@ -46,46 +46,46 @@
powerdns::config { 'gmysql-dbname':
ensure => present,
setting => 'gmysql-dbname',
value => $::powerdns::db_name,
value => $powerdns::db_name,
type => 'authoritative',
}

if $::powerdns::params::mysql_backend_package_name {
if $powerdns::params::mysql_backend_package_name {
# set up the powerdns backend
package { $::powerdns::params::mysql_backend_package_name:
package { $powerdns::params::mysql_backend_package_name:
ensure => $package_ensure,
before => Service['pdns'],
require => Package[$::powerdns::params::authoritative_package],
require => Package[$powerdns::params::authoritative_package],
}
}
if $::powerdns::backend_install {
if $powerdns::backend_install {
# mysql database
if ! defined(Class['::mysql::server']) {
if ! defined(Class['mysql::server']) {
$_db_root_password = $powerdns::db_root_password =~ Sensitive ? {
true => $powerdns::db_root_password.unwrap,
false => $powerdns::db_root_password
}

class { '::mysql::server':
class { 'mysql::server':
root_password => $_db_root_password,
create_root_my_cnf => true,
}
}

if ! defined(Class['::mysql::server::account_security']) {
class { '::mysql::server::account_security': }
if ! defined(Class['mysql::server::account_security']) {
class { 'mysql::server::account_security': }
}
}

if $::powerdns::backend_create_tables and $_db_password {
if $powerdns::backend_create_tables and $_db_password {
# make sure the database exists
mysql::db { $::powerdns::db_name:
user => $::powerdns::db_username,
mysql::db { $powerdns::db_name:
user => $powerdns::db_username,
password => $_db_password,
host => $::powerdns::db_host,
grant => [ 'ALL' ],
sql => [ $::powerdns::mysql_schema_file ],
require => Package[$::powerdns::params::mysql_backend_package_name],
host => $powerdns::db_host,
grant => ['ALL'],
sql => [$powerdns::mysql_schema_file],
require => Package[$powerdns::params::mysql_backend_package_name],
}
}
}
Loading

0 comments on commit 457b065

Please sign in to comment.