Rush has uploaded a new change for review.
https://gerrit.wikimedia.org/r/217974
Change subject: confd additions for pybal
......................................................................
confd additions for pybal
* template-ize a passed in string for
go lang template inside of the defined type
to get the correct scope variables
* no nrpe::monitor_systemd_unit for precise
This is a companion change to 217973
Change-Id: Ic9367777879dbcebae72ef5c21b28899e9c6344b
---
M modules/confd/manifests/file.pp
M modules/confd/manifests/init.pp
M modules/confd/templates/service_template.toml.erb
3 files changed, 25 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/74/217974/1
diff --git a/modules/confd/manifests/file.pp b/modules/confd/manifests/file.pp
index 94d8090..0e24a93 100644
--- a/modules/confd/manifests/file.pp
+++ b/modules/confd/manifests/file.pp
@@ -2,24 +2,26 @@
#
# Defines a service template to be monitored by confd,
# and the corresponding geneated config file.
+
define confd::file (
- $watch_keys,
- $ensure = present,
- $uid = undef,
- $gid = undef,
- $mode = '0444',
- $reload = undef,
- $check = undef,
- $source = undef,
- $content = undef,
+ $ensure = 'present',
+ $watch_keys = [],
+ $uid = undef,
+ $gid = undef,
+ $mode = '0444',
+ $reload = undef,
+ $check = undef,
+ $source = undef,
+ $content = undef,
) {
- $safe_name = regsubst('\/', '_', $title)
+
+ $safe_name = regsubst($name, '/', '_', 'G')
unless ($source or $content) {
fail('We either need a source file or a content for the config file')
}
- #TODO validate at least uid and guid
+ #TODO validate at least uid and guid
file { "/etc/confd/conf.d/${safe_name}.toml":
ensure => $ensure,
content => template('confd/service_template.toml.erb'),
@@ -29,7 +31,7 @@
ensure => $ensure,
mode => '0400',
source => $source,
- content => $content,
+ content => template($content),
notify => Service['confd'],
}
}
diff --git a/modules/confd/manifests/init.pp b/modules/confd/manifests/init.pp
index 5478a71..3c79b97 100644
--- a/modules/confd/manifests/init.pp
+++ b/modules/confd/manifests/init.pp
@@ -43,8 +43,10 @@
# Any change to a service configuration or to a template should reload
confd.
Confd::File <| |> ~> Service['confd']
- nrpe::monitor_systemd_unit { 'confd':
- require => Service['confd'],
+ if os_version('ubuntu > precise') {
+ nrpe::monitor_systemd_unit { 'confd':
+ require => Service['confd'],
+ }
}
# Log to a dedicated file
@@ -55,12 +57,9 @@
mode => '0444',
}
-
rsyslog::conf { 'confd':
source => 'puppet:///modules/confd/rsyslog.conf',
priority => 20,
require => File['/etc/logrotate.d/confd'],
}
-
-
}
diff --git a/modules/confd/templates/service_template.toml.erb
b/modules/confd/templates/service_template.toml.erb
index 646eb47..db0de8a 100644
--- a/modules/confd/templates/service_template.toml.erb
+++ b/modules/confd/templates/service_template.toml.erb
@@ -1,11 +1,15 @@
-# Confd config file for <%= @title %>
# This file is managed by Puppet!
+# Confd config file for <%= @name %>
[template]
src = "<%= @safe_name %>.tmpl"
-dest = "<%= @title %>"
+dest = "<%= @name %>"
<% if @uid %>uid = <%= @uid %><% end %>
<% if @gid %>gid = <%= @gid %><% end %>
mode = "<%= @mode %>"
-keys = <%= @watch_keys %>
+
+keys = [
+ "<%= @watch_keys %>"
+]
+
<% if @check %>check_cmd = "<%= @check %> {{.src}}"<% end %>
<% if @reload %>reload_cmd = "<%= reload %>"<% end %>
--
To view, visit https://gerrit.wikimedia.org/r/217974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9367777879dbcebae72ef5c21b28899e9c6344b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Rush <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits