1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 # Class: opnfv::resolver
13 # Add resolver content passed through astute.yaml into resolv.conf
14 # depending on the role
16 # Suitable yaml content:
31 class opnfv::resolver()
33 if $::fuel_settings['role'] {
34 if $::fuel_settings['role'] == 'primary-controller' {
37 $role = $::fuel_settings['role']
40 if ($::fuel_settings['opnfv']
41 and $::fuel_settings['opnfv']['dns']
42 and $::fuel_settings['opnfv']['dns'][$role]) {
43 $nameservers=$::fuel_settings['opnfv']['dns'][$role]
45 file { '/etc/resolv.conf':
49 content => template('opnfv/resolv.conf.erb'),
52 # /etc/resolv.conf is re-generated at each boot by resolvconf, so we
53 # need to store there as well.
55 case $::operatingsystem {
57 file { '/etc/resolvconf/resolv.conf.d/head':
61 content => template('opnfv/resolv.conf.erb'),
65 exec { 'for file in ifcfg-eth*; do grep -q -F "PEERDNS=" $file || echo "PEERDNS=no" >> $file; done ':
67 cwd => '/etc/sysconfig/network-scripts',