[MediaWiki-commits] [Gerrit] varnish: ability to remove a named instance - change (operations/puppet)

2015-12-01 Thread BBlack (Code Review)
BBlack has submitted this change and it was merged.

Change subject: varnish: ability to remove a named instance
..


varnish: ability to remove a named instance

Bug: T119396
Change-Id: I48102ab771202319a8b8622eb688bd1220bdf003
---
A modules/varnish/manifests/remove_instance.pp
1 file changed, 37 insertions(+), 0 deletions(-)

Approvals:
  BBlack: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/varnish/manifests/remove_instance.pp 
b/modules/varnish/manifests/remove_instance.pp
new file mode 100644
index 000..abdc505
--- /dev/null
+++ b/modules/varnish/manifests/remove_instance.pp
@@ -0,0 +1,37 @@
+# Ensures any varnish daemon instance with the given suffix (blank
+# for default/unnamed) is stopped and unconfigured before any
+# defined varnish::instance is configured and/or started.
+
+define varnish::remove_instance() {
+require varnish::common
+
+$suffix = $title
+
+exec { "stop-varnish${suffix}":
+user=> 'root',
+path=> '/usr/sbin:/sbin:/usr/bin:/bin',
+command => "service varnish${suffix} stop",
+onlyif  => "service varnish${suffix} status",
+}
+
+$initfiles = [
+"/etc/init.d/varnish${suffix}",
+"/etc/systemd/system/varnish${suffix}.service",
+"/lib/systemd/system/varnish${suffix}.service",
+]
+
+file { $initfiles:
+ensure  => absent,
+require => Exec["stop-varnish${suffix}"],
+notify  => Exec["systemctl-reload-vi${suffix}"],
+}
+
+exec { "systemctl-reload-vi${suffix}":
+user=> 'root',
+path=> '/usr/sbin:/sbin:/usr/bin:/bin',
+command => 'systemctl daemon-reload',
+refreshonly => true,
+}
+
+Varnish::Remove_instance <| |> -> Varnish::Instance <| |>
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/256259
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I48102ab771202319a8b8622eb688bd1220bdf003
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] varnish: ability to remove a named instance - change (operations/puppet)

2015-12-01 Thread BBlack (Code Review)
BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/256259

Change subject: varnish: ability to remove a named instance
..

varnish: ability to remove a named instance

Change-Id: I48102ab771202319a8b8622eb688bd1220bdf003
---
A modules/varnish/manifests/remove_instance.pp
1 file changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/59/256259/1

diff --git a/modules/varnish/manifests/remove_instance.pp 
b/modules/varnish/manifests/remove_instance.pp
new file mode 100644
index 000..fd7aa3d
--- /dev/null
+++ b/modules/varnish/manifests/remove_instance.pp
@@ -0,0 +1,37 @@
+# Ensures any varnish daemon instance with the given suffix (blank
+# for default/unnamed) is stopped and unconfigured before any
+# defined varnish::instance is configured and/or started.
+
+define varnish::remove_instance() {
+require varnish::common
+
+$suffix = $title
+
+exec { "stop-varnish${suffix}":
+user=> 'root',
+path=> '/usr/sbin:/sbin:/usr/bin:/bin',
+command => "service varnish${suffix} stop",
+onlyif  => "service varnish${suffix} status",
+}
+
+$initfiles = [
+"/etc/init.d/varnish${suffix}",
+"/etc/systemd/system/varnish${suffix}.service",
+"/lib/systemd/system/varnish${suffix}.service",
+]
+
+file { $initfiles:
+ensure  => absent,
+require => Exec["stop-varnish${suffix}"],
+notify  => Exec["systemctl-reload-vi${suffix}"],
+}
+
+exec { "systemctl-reload-vi${suffix}":
+user=> 'root',
+path=> '/usr/sbin:/sbin:/usr/bin:/bin',
+command => 'systemctl daemon-reload',
+refreshonly => true,
+}
+
+Varnish::remove_instance <| |> -> Varnish::instance <| |>
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/256259
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48102ab771202319a8b8622eb688bd1220bdf003
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits