Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to manage puppetmaster service status #171

Open
wants to merge 4 commits into
base: production
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ The `puppet::config` class is responsible for altering the configuration of `$co

Specifies the type of server to use `puppetserver` is always used on Puppet 4

* **service_enable**: (*bool* Default: `true`)

Specifies if the puppetmaster service should be enabled

* **module_path**: **DEPRECATED** (*string* Default: `undef`)

If this is set, it will be used to populate the basemodulepath parameter in `/etc/puppet/puppet.conf`. This does not impact [environment.conf](http://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html), which should live in your [r10k](https://github.com/adrienthebo/r10k) environment repo.
Expand Down
3 changes: 3 additions & 0 deletions manifests/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
# Specifies minute to run the report clean cronjob
# @param report_clean_weekday ([String] Default: '0')
# Specifies weekday to run the report clean cronjob
# @param service_enable [Boolean] Default: true
# Specifies if the Puppet Master service should be enabled
# @param server_type ([String] Default Puppet 4: 'puppetserver' Default Puppet 4: 'passenger')
# Specifies the type of server to use puppetserver is always used on Puppet 4
# @param $external_nodes ([String] Default undef)
Expand Down Expand Up @@ -125,6 +127,7 @@
$report_clean_min = '22',
$report_clean_hour = '21',
$report_clean_weekday = '0',
$service_enable = true,
$server_type = $::puppet::defaults::server_type,
$server_version = 'installed',
$external_nodes = undef,
Expand Down
1 change: 1 addition & 0 deletions manifests/master/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$report_clean_weekday = $puppet::master::report_clean_weekday
$external_nodes = $puppet::master::external_nodes
$node_terminus = $puppet::master::node_terminus
$service_enable = $puppet::master::service_enable

if ($ca_server != undef) {
if ($ca_server == $::fqdn) {
Expand Down
9 changes: 5 additions & 4 deletions manifests/master/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
class puppet::master::server {
include ::puppet::master
include ::puppet::defaults
$sysconfigdir = $::puppet::defaults::sysconfigdir
$java_ram = $::puppet::master::java_ram
$sysconfigdir = $::puppet::defaults::sysconfigdir
$java_ram = $::puppet::master::java_ram
$service_enable = $::puppet::master::service_enable

ini_subsetting { 'puppet server Xmx java_ram':
ensure => present,
Expand All @@ -29,8 +30,8 @@
}

service { 'puppetserver':
ensure => 'running',
enable => true,
ensure => $service_enable,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will setting this to true work with all versions?
Some may not like it.

enable => $service_enable,
require => Class[puppet::master::config],
subscribe => [
Class[puppet::master::hiera],
Expand Down
4 changes: 4 additions & 0 deletions manifests/profile/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
# Specifies the version of the puppetmaster package to install
# @param server_type ([String] Default Puppet 4: 'puppetserver' Default Puppet 4: 'passenger')
# Specifies the type of server to use puppetserver is always used on Puppet 4
# @param service_enable [Boolean] Default: true
# Specifies if the Puppet Master service should be enabled
# @param $external_nodes ([String] Default undef)
# Specifies the script tom use as a node classifier
# @param $node_terminus ([String] Default undef)
Expand Down Expand Up @@ -148,6 +150,7 @@
$puppet_version = 'installed',
$server_type = undef,
$server_version = 'installed',
$service_enable = true,
$external_nodes = undef,
$node_terminus = undef,
$puppetdb = false,
Expand Down Expand Up @@ -198,6 +201,7 @@
passenger_stat_throttle_rate => $passenger_stat_throttle_rate,
puppet_fqdn => $puppet_fqdn,
server_version => $server_version,
service_enable => $service_enable,
external_nodes => $external_nodes,
node_terminus => $node_terminus,
server_type => $server_type,
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_master_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
end
it 'should manage the puppet server service' do
should contain_service('puppetserver').with({
'ensure' => 'running',
'ensure' => 'true',
'enable' => 'true'
}).that_requires(
'Class[puppet::master::config]'
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_master_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end
end#arrays

['autosign','eyaml_keys','future_parser'].each do |bools|
['autosign','eyaml_keys','future_parser','service_enable'].each do |bools|
context "when the #{bools} parameter is not an boolean" do
let(:params) {{bools => "BOGON"}}
it 'should fail' do
Expand Down