fuel-library/deployment/puppet/osnailyfacter/manifests/resolvconf.pp
Sergii Golovatiuk a454d0003e 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>
2015-04-16 21:26:57 +00:00

60 lines
1.3 KiB
Puppet

# == Class: osnailyfacter::resolvconf
#
# Configure resolv.conf on fuel nodes
#
# === Parameters
#
# [*$management_vip*]
# Management virtual ip address
#
# === Examples
#
# class { osnailyfacter::resolvconf:
# management_vip => '1.1.1.1',
# }
#
# === Authors
#
# Mirantis
#
# === Copyright
#
# GNU GPL
#
class osnailyfacter::resolvconf (
$management_vip
) {
$file_path = $::osfamily ? {
/(RedHat|CentOS)/ => '/etc/resolv.conf',
/(Debian|Ubuntu)/ => '/etc/resolvconf/resolv.conf.d/head',
default => '/etc/resolv.conf',
}
file { $file_path:
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], File['/etc/default/resolvconf'], ]
}
}
}