3 changes: 2 additions & 1 deletion .sync.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
.travis.yml:
beaker_sets:
- centos7-64
- centos6-64
- debian8-64
- debian9-64
- debian10-64
Rakefile:
param_docs_pattern:
- manifests/init.pp
26 changes: 24 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ matrix:
- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet5
- BEAKER_setfile=centos7-64{hostname=centos7-64.example.com}
- BEAKER_setfile=centos6-64{hostname=centos6-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
Expand All @@ -23,7 +23,7 @@ matrix:
- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=centos7-64{hostname=centos7-64.example.com}
- BEAKER_setfile=centos6-64{hostname=centos6-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
Expand Down Expand Up @@ -75,5 +75,27 @@ matrix:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet5
- BEAKER_setfile=debian10-64{hostname=debian10-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

- rvm: 2.5.1
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=debian10-64{hostname=debian10-64.example.com}
script: bundle exec rake beaker
services: docker
bundler_args: --without development
before_install:
- echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
- sudo service docker restart

bundler_args: --without system_tests development
dist: xenial
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Changelog

## [6.2.0](https://github.com/theforeman/puppet-dns/tree/6.2.0) (2019-07-18)
## [7.0.0](https://github.com/theforeman/puppet-dns/tree/7.0.0) (2020-02-11)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/6.2.0...7.0.0)

**Breaking changes:**

- Refactor soaip in dns::zone [\#151](https://github.com/theforeman/puppet-dns/pull/151) ([ekohl](https://github.com/ekohl))

**Implemented enhancements:**

- Add Debian 10 [\#153](https://github.com/theforeman/puppet-dns/pull/153) ([mmoll](https://github.com/mmoll))
- Add manage\_service parameter [\#149](https://github.com/theforeman/puppet-dns/pull/149) ([flyingstar16](https://github.com/flyingstar16))

## [6.2.0](https://github.com/theforeman/puppet-dns/tree/6.2.0) (2019-07-19)

[Full Changelog](https://github.com/theforeman/puppet-dns/compare/6.1.0...6.2.0)

Expand Down Expand Up @@ -166,4 +179,4 @@
* Update gitignore, change fixtures to HTTPS


\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 5

gem 'rake'
gem 'rspec', '~> 3.0'
gem 'rdoc', '~> 5.1.0', {"platforms"=>["ruby_21"]}
gem 'rspec-puppet', '~> 2.3'
gem 'rspec-puppet-facts', '>= 1.7'
gem 'puppetlabs_spec_helper', '>= 2.1.1'
Expand All @@ -25,7 +24,7 @@ gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-version_comparison-check'
gem 'simplecov'
gem 'github_changelog_generator', {"git"=>"https://github.com/skywinder/github-changelog-generator", "ref"=>"20ee04ba1234e9e83eb2ffb5056e23d641c7a018", "groups"=>["development"]} if RUBY_VERSION >= '2.2.2'
gem 'github_changelog_generator', '>= 1.15.0'
gem 'puppet-blacksmith', '>= 4.1.0', {"groups"=>["development"]}
gem 'beaker', '>= 4.2.0', {"groups"=>["system_tests"]}
gem 'beaker-docker', {"groups"=>["system_tests"]}
Expand Down
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
# Should this module manage the Unix system group under which BIND runs (see
# dns::params)? Defaults to true. Set to false if you want to manage the
# system group yourself.
# @param manage_service
# Should this module manage the dns service?
# This only applies to the service management (running, stopped) and not to
# whether the service should be installed or not.
# IMPORTANT: this will not reload the service after a config change, you'll
# have to do that manually or via a separate call to notify
# @param namedservicename
# Name of the service
# @param zonefilepath
Expand Down Expand Up @@ -125,6 +131,7 @@
Stdlib::Absolutepath $publicviewpath = $dns::params::publicviewpath,
Stdlib::Absolutepath $vardir = $dns::params::vardir,
Boolean $group_manage = $dns::params::group_manage,
Boolean $manage_service = $dns::params::manage_service,
String $namedservicename = $dns::params::namedservicename,
Stdlib::Absolutepath $zonefilepath = $dns::params::zonefilepath,
Variant[Enum['unmanaged'], Stdlib::Absolutepath] $localzonepath = $dns::params::localzonepath,
Expand Down
4 changes: 2 additions & 2 deletions manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
group => $dns::group,
mode => '0640',
content => template('dns/key.erb'),
notify => Service[$dns::namedservicename],
notify => Class['dns::service'],
}
} else {
exec { "create-${filename}":
command => "${dns::rndcconfgen} -r /dev/urandom -a -c ${keyfilename} -b ${keysize} -k ${name}",
creates => $keyfilename,
notify => Service[$dns::namedservicename],
notify => Class['dns::service'],
}-> file { $keyfilename:
owner => 'root',
group => $dns::params::group,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
},
}

$manage_service = true
$service_ensure = 'running'
$service_enable = true
$acls = {}
Expand Down
14 changes: 8 additions & 6 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Enable and start dns service
# @api private
class dns::service {
service { $dns::namedservicename:
ensure => $dns::service_ensure,
enable => $dns::service_enable,
hasstatus => true,
hasrestart => true,
restart => $dns::service_restart_command,
if $dns::manage_service {
service { $dns::namedservicename:
ensure => $dns::service_ensure,
enable => $dns::service_enable,
hasstatus => true,
hasrestart => true,
restart => $dns::service_restart_command,
}
}
}
2 changes: 1 addition & 1 deletion manifests/view.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
owner => root,
group => $dns::params::group,
mode => '0640',
notify => Service[$dns::namedservicename],
notify => Class['dns::service'],
before => Concat[$dns::publicviewpath],
}

Expand Down
17 changes: 14 additions & 3 deletions manifests/zone.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Define new zone for the dns
# @summary Define new zone for the dns
#
# @param soaip
# The IP address for the SOA. If `reverse` is false, an A record will be
# created pointing to this IP address for `$soa`. This only makes sense if
# `$soa` is withing this zone and needs glue records.
#
# @param soaipv6
# The IPv6 address for the SOA. If `reverse` is false, an AAAA record will be
# created pointing to this IP address for `$soa`. This only makes sense if
# `$soa` is withing this zone and needs glue records.
#
# @param manage_file
# Whether the manage the file resource. When true $manage_file_name is implied.
Expand All @@ -19,7 +29,8 @@
String $soa = $fqdn,
Boolean $reverse = false,
String $ttl = '10800',
Stdlib::Compat::Ip_address $soaip = $ipaddress,
Optional[Stdlib::IP::Address::V4] $soaip = undef,
Optional[Stdlib::IP::Address::V6] $soaipv6 = undef,
Integer $refresh = 86400,
Integer $update_retry = 3600,
Integer $expire = 604800,
Expand Down Expand Up @@ -87,7 +98,7 @@
mode => '0644',
content => template('dns/zone.header.erb'),
replace => false,
notify => Service[$dns::namedservicename],
notify => Class['dns::service'],
}
}
}
5 changes: 3 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-dns",
"version": "6.2.0",
"version": "7.0.0",
"author": "theforeman",
"summary": "Manage the ISC BIND daemon",
"license": "Apache-2.0",
Expand Down Expand Up @@ -63,7 +63,8 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
"9"
"9",
"10"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/dns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
include dns
dns::zone { 'example.com':
soa => 'ns1.example.com',
soa => 'ns1.example.com',
soaip => '192.0.2.1',
soaipv6 => '2001:db8::1',
}
EOS
end
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/views_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ class {'::dns':
dns::zone { 'example.com-v4':
zone => 'example.com',
soa => 'ns1-v4.example.com',
soaip => '192.0.2.1',
filename => 'db.example.com-v4',
target_views => ['v4'],
}
dns::zone { 'example.com-v6':
zone => 'example.com',
soa => 'ns1-v6.example.com',
soaipv6 => '2001:db8::1',
filename => 'db.example.com-v6',
target_views => ['v6'],
}
Expand Down
36 changes: 31 additions & 5 deletions spec/classes/dns_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
let(:facts) do
{
:clientcert => 'puppetmaster.example.com',
:concat_basedir => '/doesnotexist',
:fqdn => 'puppetmaster.example.com',
:osfamily => 'RedHat',
:ipaddress => '192.0.2.1',
}
end

Expand Down Expand Up @@ -228,6 +226,16 @@
it { should_not contain_group('named') }
end

describe 'with manage_service true' do
let(:params) { {:manage_service => true} }
it { should contain_service('named') }
end

describe 'with manage_service false' do
let(:params) { {:manage_service => false} }
it { should_not contain_service('named') }
end

describe 'with acls set' do
let(:params) { {:acls => { 'trusted_nets' => [ '127.0.0.1/24', '127.0.1.0/24' ] } } }
it { verify_concat_fragment_exact_contents(catalogue, 'named.conf+10-main.dns', [
Expand Down Expand Up @@ -392,7 +400,6 @@
let(:facts) do
{
:clientcert => 'puppetmaster.example.com',
:concat_basedir => '/doesnotexist',
:fqdn => 'puppetmaster.example.com',
:osfamily => 'FreeBSD',
}
Expand Down Expand Up @@ -453,17 +460,25 @@
let(:params) { {:group_manage => false} }
it { should_not contain_group('bind') }
end

describe 'with manage_service true' do
let(:params) { {:manage_service => true} }
it { should contain_service('named') }
end

describe 'with manage_service false' do
let(:params) { {:manage_service => false} }
it { should_not contain_service('named') }
end
end

describe 'on Debian' do

let(:facts) do
{
:clientcert => 'puppetmaster.example.com',
:concat_basedir => '/doesnotexist',
:fqdn => 'puppetmaster.example.com',
:osfamily => 'Debian',
:ipaddress => '192.0.2.1',
}
end

Expand Down Expand Up @@ -591,5 +606,16 @@
)
}
end

describe 'with manage_service true' do
let(:params) { {:manage_service => true} }
it { should contain_service('bind9') }
end

describe 'with manage_service false' do
let(:params) { {:manage_service => false} }
it { should_not contain_service('bind9') }
end

end
end
2 changes: 0 additions & 2 deletions spec/defines/dns_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
let(:facts) do
{
:clientcert => 'puppetmaster.example.com',
:concat_basedir => '/doesnotexist',
:fqdn => 'puppetmaster.example.com',
:ipaddress => '192.168.1.1',
:osfamily => 'RedHat',
}
end
Expand Down
2 changes: 0 additions & 2 deletions spec/defines/dns_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
let(:facts) do
{
:clientcert => 'puppetmaster.example.com',
:concat_basedir => '/doesnotexist',
:fqdn => 'puppetmaster.example.com',
:ipaddress => '192.168.1.1',
:osfamily => 'RedHat',
}
end
Expand Down
Loading