diff --git a/site-modules/profile/files/resolv_conf/dhcp-noresolvconf b/site-modules/profile/files/resolv_conf/dhcp-noresolvconf new file mode 100644 index 00000000..aff92d7c --- /dev/null +++ b/site-modules/profile/files/resolv_conf/dhcp-noresolvconf @@ -0,0 +1,9 @@ +# Disable modification of /etc/resolv.conf by isc-dhcp-client, according to +# dhclient-script(8). +# +# File managed by puppet (class ::profile::resolv_conf), changes will be lost. + +# Override the resolv.conf hook to do nothing +make_resolv_conf () { + : +} diff --git a/site-modules/profile/manifests/resolv_conf.pp b/site-modules/profile/manifests/resolv_conf.pp index c4202e96..aeca6d5a 100644 --- a/site-modules/profile/manifests/resolv_conf.pp +++ b/site-modules/profile/manifests/resolv_conf.pp @@ -1,10 +1,25 @@ # Configure resolv.conf class profile::resolv_conf { $nameservers = lookup('dns::nameservers') $search_domains = lookup('dns::search_domains') class {'::resolv_conf': nameservers => $nameservers, searchpath => $search_domains, } + + file {['/etc/dhcp', '/etc/dhcp/dhclient-enter-hooks.d']: + ensure => directory, + owner => 'root', + group => 'root', + mode => '0644', + } + + file {'/etc/dhcp/dhclient-enter-hooks.d/noresolvconf': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/profile/resolv_conf/dhcp-noresolvconf', + } }