From 9a522267068a1bcede55ba388d526ddc263d155f Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 28 Jun 2013 11:28:13 -0400 Subject: restart stunnels if /etc/hosts is changed (#3031) Due to the fact that /etc/hosts is modified in the early stage setup.pp run and the stunnel service is not deployed on an initial puppet run, we cannot simply override the Service['stunnel'] but instead need to trigger a restart through an exec calling the init script that first tests to see if it is present. Change-Id: I6bf5dfece9ecbdb8319747774185dec50d5a55f6 --- puppet/modules/site_config/manifests/hosts.pp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'puppet') diff --git a/puppet/modules/site_config/manifests/hosts.pp b/puppet/modules/site_config/manifests/hosts.pp index 83a1040d..ccedf036 100644 --- a/puppet/modules/site_config/manifests/hosts.pp +++ b/puppet/modules/site_config/manifests/hosts.pp @@ -14,6 +14,17 @@ class site_config::hosts() { refreshonly => true; } + # we depend on reliable hostnames from /etc/hosts for the stunnel services + # so restart stunnel service when /etc/hosts is modified + # because this is done in an early stage, the stunnel module may not + # have been deployed and will not be available for overriding, so + # this is handled in an unorthodox manner + exec { '/etc/init.d/stunnel4 restart': + subscribe => File['/etc/hosts'], + refreshonly => true, + onlyif => 'test -f /etc/init.d/stunnel4'; + } + file { '/etc/hosts': content => template('site_config/hosts'), mode => '0644', -- cgit v1.2.3