Alexandros Kosiaris has submitted this change and it was merged. Change subject: Introduce base::puppet::config definition ......................................................................
Introduce base::puppet::config definition Add a definition that allows to provide puppetmaster configuration stanzas in /etc/puppet.conf.d/ and notifies the configuration compilation process. This removes the burden of populating files and notifying the compilation process from consumers like base::puppet and puppetmaster::config which are being transitioned in this commit as well. Change-Id: I45d96ee338d191bd4d6baf63ec02484cd6854913 --- M modules/base/manifests/puppet.pp A modules/base/manifests/puppet/config.pp M modules/puppetmaster/manifests/config.pp 3 files changed, 28 insertions(+), 12 deletions(-) Approvals: Alexandros Kosiaris: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/base/manifests/puppet.pp b/modules/base/manifests/puppet.pp index 7183e62..9889f69 100644 --- a/modules/base/manifests/puppet.pp +++ b/modules/base/manifests/puppet.pp @@ -30,12 +30,9 @@ mode => '0550', } - file { '/etc/puppet/puppet.conf.d/10-main.conf': - owner => 'root', - group => 'root', - mode => '0444', + base::puppet::config { 'main': + prio => 10, content => template('base/puppet.conf.d/10-main.conf.erb'), - notify => Exec['compile puppet.conf'], } if $::realm == 'labs' { diff --git a/modules/base/manifests/puppet/config.pp b/modules/base/manifests/puppet/config.pp new file mode 100644 index 0000000..db36ad0 --- /dev/null +++ b/modules/base/manifests/puppet/config.pp @@ -0,0 +1,24 @@ +# Definition base::puppet::config +# Populate a puppet config file and notify the compilation process +define base::puppet::config( + $ensure='present', + $prio=10, + $content=undef, + $source=undef, +) { + if $source == undef and $content == undef { + fail('you must provide either "source" or "content"') + } + $title_safe = regsubst($title, '[\W_]', '-', 'G') + $conf_file = sprintf('%02d-%s.conf', $prio, $title_safe) + + file { "/etc/puppet/puppet.conf.d/${conf_file}": + ensure => $ensure, + content => $content, + source => $source, + owner => 'root', + group => 'root', + mode => '0444', + notify => Exec['compile puppet.conf'], + } +} diff --git a/modules/puppetmaster/manifests/config.pp b/modules/puppetmaster/manifests/config.pp index 0c6b2f7..33d7d0e 100644 --- a/modules/puppetmaster/manifests/config.pp +++ b/modules/puppetmaster/manifests/config.pp @@ -3,14 +3,9 @@ # This class handles the master part of /etc/puppet.conf. # Do not include directly. class puppetmaster::config { - include base::puppet - - file { '/etc/puppet/puppet.conf.d/20-master.conf': - owner => 'root', - group => 'root', - mode => '0444', + base::puppet::config { 'master': + prio => 20, content => template('puppetmaster/20-master.conf.erb'), - notify => Class['base::puppet'], } # See https://tickets.puppetlabs.com/browse/PUP-1237 -- To view, visit https://gerrit.wikimedia.org/r/212300 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I45d96ee338d191bd4d6baf63ec02484cd6854913 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits