Yuvipanda has uploaded a new change for review.
https://gerrit.wikimedia.org/r/226748
Change subject: labstore: Add systemd units for replicating NFS volumes
......................................................................
labstore: Add systemd units for replicating NFS volumes
- Also add a param to base::service_unit to allow it to not
declare service stanzas, which is needed in this case since
we do not want them to autostart yet
Change-Id: Ib8be8230011a1f3dacdf8ca026ecadb4c6037cf4
---
M modules/base/manifests/service_unit.pp
M modules/labstore/manifests/fileserver.pp
A modules/labstore/templates/initscripts/replicate-maps.systemd.erb
A modules/labstore/templates/initscripts/replicate-others.systemd.erb
A modules/labstore/templates/initscripts/replicate-tools.systemd.erb
5 files changed, 45 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/48/226748/1
diff --git a/modules/base/manifests/service_unit.pp
b/modules/base/manifests/service_unit.pp
index 6d3dadc..a84bc99 100644
--- a/modules/base/manifests/service_unit.pp
+++ b/modules/base/manifests/service_unit.pp
@@ -37,6 +37,9 @@
#[*refresh*]
# Boolean - tells puppet if a change in the config should notify the service
directly
#
+#[*declare_service*]
+# Boolean - tells puppet if a service {} stanza is required or not
+#
#[*service_params*]
# An hash of parameters that we want to apply to the service resource
#
@@ -63,6 +66,7 @@
$strict = true,
$refresh = true,
$template_name = $name,
+ $declare_service = true,
$service_params = {},
) {
@@ -116,9 +120,11 @@
}
}
- $base_params = {
- ensure => ensure_service($ensure),
- provider => $::initsystem }
- $params = merge($base_params, $service_params)
- ensure_resource('service',$name, $params)
+ if $declare_service {
+ $base_params = {
+ ensure => ensure_service($ensure),
+ provider => $::initsystem }
+ $params = merge($base_params, $service_params)
+ ensure_resource('service',$name, $params)
+ }
}
diff --git a/modules/labstore/manifests/fileserver.pp
b/modules/labstore/manifests/fileserver.pp
index 7d562ed..bb8baa5 100644
--- a/modules/labstore/manifests/fileserver.pp
+++ b/modules/labstore/manifests/fileserver.pp
@@ -39,6 +39,22 @@
require => File['/etc/replication-rsync.conf'],
}
+ base::service_unit { 'replicate-maps':
+ ensure => present,
+ systemd => true,
+ declare_service => false,
+ }
+
+ base::service_unit { 'replicate-tools':
+ ensure => present,
+ systemd => true,
+ declare_service => false,
+ }
+ base::service_unit { 'replicate-others':
+ ensure => present,
+ systemd => true,
+ declare_service => false,
+ }
# There is no service {} stanza on purpose -- this service
# must *only* be started by a manual operation because it must
# run exactly once on whichever NFS server is the current
diff --git a/modules/labstore/templates/initscripts/replicate-maps.systemd.erb
b/modules/labstore/templates/initscripts/replicate-maps.systemd.erb
new file mode 100644
index 0000000..7542cfc
--- /dev/null
+++ b/modules/labstore/templates/initscripts/replicate-maps.systemd.erb
@@ -0,0 +1,6 @@
+[Unit]
+Description=Replicate storage between hosts (maps)
+
+[Service]
+ExecStart=/usr/local/sbin/storage-replicate /srv/project/maps <%= @target_host
%> /srv/eqiad/maps
+Restart=no
diff --git
a/modules/labstore/templates/initscripts/replicate-others.systemd.erb
b/modules/labstore/templates/initscripts/replicate-others.systemd.erb
new file mode 100644
index 0000000..6af8d93
--- /dev/null
+++ b/modules/labstore/templates/initscripts/replicate-others.systemd.erb
@@ -0,0 +1,6 @@
+[Unit]
+Description=Replicate storage between hosts (other projects)
+
+[Service]
+ExecStart=/usr/local/sbin/storage-replicate /srv/others <%= @target_host %>
/srv/eqiad/others
+Restart=no
diff --git a/modules/labstore/templates/initscripts/replicate-tools.systemd.erb
b/modules/labstore/templates/initscripts/replicate-tools.systemd.erb
new file mode 100644
index 0000000..b9230c4
--- /dev/null
+++ b/modules/labstore/templates/initscripts/replicate-tools.systemd.erb
@@ -0,0 +1,6 @@
+[Unit]
+Description=Replicate storage between hosts (tools)
+
+[Service]
+ExecStart=/usr/local/sbin/storage-replicate /srv/project/tools <%=
@target_host %> /srv/eqiad/tools
+Restart=no
--
To view, visit https://gerrit.wikimedia.org/r/226748
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8be8230011a1f3dacdf8ca026ecadb4c6037cf4
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits