Create /etc/resolv.conf as a link

resolvconf service manages /run/resolvconf/resolv.conf by default on
Ubuntu 12.04 and 14.04. resolv.conf should be symlink to it.

Closes-Bug: 1434232
Change-Id: I501538326c095e47adafae476c2c3a299509fa84
Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
This commit is contained in:
Sergii Golovatiuk 2015-04-16 13:43:54 +02:00 committed by Vladimir Kuklin
parent db5f39e96e
commit a454d0003e

View File

@ -31,15 +31,29 @@ class osnailyfacter::resolvconf (
}
file { $file_path:
ensure => present,
ensure => file,
content => template('osnailyfacter/resolv.conf.erb')
}
if $::osfamily =~ /(Debian|Ubuntu)/ {
package { 'resolvconf':
ensure => present,
} ->
file { '/etc/resolv.conf':
ensure => link,
target => '/run/resolvconf/resolv.conf',
} ~>
exec { 'dpkg-reconfigure resolvconf':
command => '/usr/sbin/dpkg-reconfigure -f noninteractive resolvconf',
refreshonly => true,
}
file {'/etc/default/resolvconf':
content => 'REPORT_ABSENT_SYMLINK="yes"',
}
service { 'resolvconf':
ensure => running,
enable => true,
subscribe => File[$file_path],
subscribe => [ File[$file_path], File['/etc/default/resolvconf'], ]
}
}
}