Move resolv.conf to nailgun host role, dnsmasq.upstream to cobbler

This reverses some previously hardcoded
values for resolv.conf and dnsmasq.upstream
where they had assumed values during OS
installation. DHCP hooks are moved back
to the nailgun::host role so that when the
host gets a DHCP lease, it does not
overwrite /etc/resolv.conf

blueprint fuel-containerizatoin-of-services

Change-Id: I30bc2b5590530fbdf51059b11434ffcdd8b5f3de
This commit is contained in:
Matthew Mosesohn 2014-04-29 12:30:01 +04:00
parent 68b11620e7
commit 6f31c7de64
11 changed files with 55 additions and 23 deletions

View File

@ -46,6 +46,8 @@ class cobbler(
$domain_name = 'local',
$name_server = $ipaddress,
$next_server = $ipaddress,
$dns_upstream = '8.8.8.8',
$dns_search = 'domain.tld',
$dhcp_start_address = '10.0.0.201',
$dhcp_end_address = '10.0.0.254',
@ -75,8 +77,10 @@ class cobbler(
include ::cobbler::iptables
class { ::cobbler::snippets : }
class { ::cobbler::server :
domain_name => $domain_name,
production => $production,
domain_name => $domain_name,
production => $production,
dns_upstream => $dns_upstream,
dns_search => $dns_search,
}
cobbler_digest_user {$cobbler_user:

View File

@ -14,8 +14,10 @@
class cobbler::server (
$domain_name = "local",
$production = 'prod',
$domain_name = 'local',
$dns_search = 'local',
$dns_upstream = '8.8.8.8',
) {
include cobbler::packages
@ -115,7 +117,8 @@ class cobbler::server (
refreshonly => true,
require => [
Package[$cobbler::packages::cobbler_package],
Package[$cobbler::packages::dnsmasq_package],],
Package[$cobbler::packages::dnsmasq_package],
File['/etc/dnsmasq.upstream']],
subscribe => Service[$cobbler_service],
notify => [Service[$dnsmasq_service], Service["xinetd"]],
tries => 20,
@ -180,20 +183,10 @@ class cobbler::server (
Package[$cobbler::packages::cobbler_package],]
}
if $production !~ /docker/ {
file { "/etc/dhcp/dhcp-enter-hooks":
content => template("cobbler/dhcp-enter-hooks.erb"),
owner => root,
group => root,
mode => 0755,
}
file { "/etc/resolv.conf":
content => template("cobbler/resolv.conf.erb"),
owner => root,
group => root,
mode => 0644,
}
file { '/etc/dnsmasq.upstream':
content => template("cobbler/dnsmasq.upstream.erb"),
owner => 'root',
group => 'root',
mode => '0644',
}
}

View File

@ -0,0 +1,3 @@
domain <%= @domain %>
search <%= @dns_search %>
nameserver <%= @dns_upstream %>

View File

@ -1,3 +0,0 @@
search <%= @domain_name %>
domain <%= @domain_name %>
nameserver 127.0.0.1

View File

@ -35,6 +35,7 @@ node default {
} else {
$cobbler_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress']
}
$dns_upstream = $::fuel_settings['DNS_UPSTREAM']
$dhcp_start_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_start']
$dhcp_end_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_end']
$dhcp_netmask = $::fuel_settings['ADMIN_NETWORK']['netmask']
@ -67,6 +68,7 @@ node default {
server => '127.0.0.1',
name_server => $cobbler_host,
next_server => $cobbler_host,
dns_upstream => $dns_upstream,
dhcp_start_address => $dhcp_start_address,
dhcp_end_address => $dhcp_end_address,
dhcp_netmask => $dhcp_netmask,

View File

@ -18,6 +18,7 @@ class { 'nailgun::packages': }
class { 'nailgun::host':
production => $production,
cobbler_host => $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
nailgun_group => $nailgun_group,
nailgun_user => $nailgun_user,
}

View File

@ -9,6 +9,10 @@ class nailgun::cobbler(
$server = $::ipaddress,
$name_server = $::ipaddress,
$next_server = $::ipaddress,
$dns_upstream = '8.8.8.8',
$domain_name = 'domain.tld',
$dns_search = 'domain.tld',
$dhcp_start_address,
$dhcp_end_address,
$dhcp_netmask,
@ -34,7 +38,9 @@ class nailgun::cobbler(
server => $server,
production => $production,
domain_name => $domain,
domain_name => $domain_name,
dns_upstream => $dns_upstream,
dns_search => $dns_search,
name_server => $name_server,
next_server => $next_server,

View File

@ -1,5 +1,7 @@
class nailgun::host(
$production,
$cobbler_host = '127.0.0.1',
$dns_search = "domain.tld",
$nailgun_group = "nailgun",
$nailgun_user = "nailgun",
$gem_source = "http://localhost/gems/",
@ -49,4 +51,18 @@ $gem_source = "http://localhost/gems/",
mode => '0755',
}
file { "/etc/dhcp/dhcp-enter-hooks":
content => template("nailgun/dhcp-enter-hooks.erb"),
owner => 'root',
group => 'root',
mode => '0755',
}
file { "/etc/resolv.conf":
content => template("nailgun/resolv.conf.erb"),
owner => 'root',
group => 'root',
mode => '0644',
}
}

View File

@ -26,6 +26,9 @@ class nailgun(
$cobbler_password = "cobbler",
$cobbler_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress'],
$cobbler_url = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}/cobbler_api",
$dns_upstream = $::fuel_settings['DNS_UPSTREAM'],
$dns_domain = $::fuel_settings['DNS_DOMAIN'],
$dns_search = $::fuel_settings['DNS_SEARCH'],
$dhcp_start_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_start'],
$dhcp_end_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_end'],
$dhcp_netmask = $::fuel_settings['ADMIN_NETWORK']['netmask'],
@ -73,6 +76,7 @@ class nailgun(
class { 'nailgun::host':
production => $production,
cobbler_host => $cobbler_host,
nailgun_group => $nailgun_group,
nailgun_user => $nailgun_user,
}
@ -209,6 +213,9 @@ class nailgun(
server => $cobbler_host,
name_server => $cobbler_host,
next_server => $cobbler_host,
dns_upstream => $dns_upstream,
domain_name => $dns_domain,
dns_search => $dns_search,
dhcp_start_address => $dhcp_start_address,
dhcp_end_address => $dhcp_end_address,
dhcp_netmask => $dhcp_netmask,

View File

@ -0,0 +1,3 @@
search <%= @dns_search %>
domain <%= @domain %>
nameserver <%= @cobbler_host %>