summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/manifests/dhclient.pp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-06-19 13:41:23 -0400
committerMicah Anderson <micah@riseup.net>2013-06-19 13:41:23 -0400
commitd9614163ed327fc17d27ac623dfd639ce00a43ce (patch)
tree4f8ff484d30f76fb76470d9f6148ed844b3715f2 /puppet/modules/site_config/manifests/dhclient.pp
parentcd9f0dc7d3fed744ea9bf695a497845a7297e1ca (diff)
disable dhclient from modifying the /etc/resolv.conf file on openstack/amazon instances
The dhclient in these environments is quite aggressive and overwrites the nameservers we've deliberately chosen to use with google's nameservers. This commit attempts to fix that. The dhclient methodology for altering these things is particularly unpleasant. We effectively redefine the functions that mess with this file to be noops in the /etc/dhcp/dhclient-enter-hooks.d directory and then we are forced to restart dhclient by shipping a script that tries to determine the correct PID and arguments that it was running as before killing and restarting it with the same arguments. See debian bugs #681698, #712796 for further discussion about how to make this less difficult Change-Id: I51cf40cf98eaddcefd8180e157b6e3ca824173f0
Diffstat (limited to 'puppet/modules/site_config/manifests/dhclient.pp')
-rw-r--r--puppet/modules/site_config/manifests/dhclient.pp30
1 files changed, 30 insertions, 0 deletions
diff --git a/puppet/modules/site_config/manifests/dhclient.pp b/puppet/modules/site_config/manifests/dhclient.pp
new file mode 100644
index 00000000..7ac0caf3
--- /dev/null
+++ b/puppet/modules/site_config/manifests/dhclient.pp
@@ -0,0 +1,30 @@
+class site_config::dhclient {
+
+ # Unfortunately, there does not seem to be a way to reload the dhclient.conf
+ # config file, or a convenient way to disable the modifications to
+ # /etc/resolv.conf. So the following makes the functions involved noops and
+ # ships a script to kill and restart dhclient. See the debian bugs:
+ # #681698, #712796
+
+ include site_config::params
+
+ file { '/usr/local/sbin/reload_dhclient':
+ owner => 0,
+ group => 0,
+ mode => '0755',
+ content => template('site_config/reload_dhclient.erb');
+ }
+
+ exec { 'reload_dhclient':
+ refreshonly => true,
+ command => '/usr/local/sbin/reload_dhclient';
+ }
+
+ file { '/etc/dhcp/dhclient-enter-hooks.d/disable_resolvconf':
+ content => 'make_resolv_conf() { : ; } ; set_hostname() { : ; }',
+ mode => '0644',
+ owner => 'root',
+ group => 'root',
+ notify => Exec['reload_dhclient'];
+ }
+}