diff --git a/deployment/puppet/cobbler/manifests/init.pp b/deployment/puppet/cobbler/manifests/init.pp index b00db43121..8fd391d2cb 100644 --- a/deployment/puppet/cobbler/manifests/init.pp +++ b/deployment/puppet/cobbler/manifests/init.pp @@ -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: diff --git a/deployment/puppet/cobbler/manifests/server.pp b/deployment/puppet/cobbler/manifests/server.pp index 554383ee1b..4995b8fd23 100644 --- a/deployment/puppet/cobbler/manifests/server.pp +++ b/deployment/puppet/cobbler/manifests/server.pp @@ -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', } - } diff --git a/deployment/puppet/cobbler/templates/dnsmasq.upstream.erb b/deployment/puppet/cobbler/templates/dnsmasq.upstream.erb new file mode 100644 index 0000000000..f209009528 --- /dev/null +++ b/deployment/puppet/cobbler/templates/dnsmasq.upstream.erb @@ -0,0 +1,3 @@ +domain <%= @domain %> +search <%= @dns_search %> +nameserver <%= @dns_upstream %> diff --git a/deployment/puppet/cobbler/templates/resolv.conf.erb b/deployment/puppet/cobbler/templates/resolv.conf.erb deleted file mode 100644 index 6dd210edf8..0000000000 --- a/deployment/puppet/cobbler/templates/resolv.conf.erb +++ /dev/null @@ -1,3 +0,0 @@ -search <%= @domain_name %> -domain <%= @domain_name %> -nameserver 127.0.0.1 diff --git a/deployment/puppet/nailgun/examples/cobbler-only.pp b/deployment/puppet/nailgun/examples/cobbler-only.pp index 77b959f43c..4f12344ee5 100644 --- a/deployment/puppet/nailgun/examples/cobbler-only.pp +++ b/deployment/puppet/nailgun/examples/cobbler-only.pp @@ -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, diff --git a/deployment/puppet/nailgun/examples/host-only.pp b/deployment/puppet/nailgun/examples/host-only.pp index a562099672..32a9b30f6d 100644 --- a/deployment/puppet/nailgun/examples/host-only.pp +++ b/deployment/puppet/nailgun/examples/host-only.pp @@ -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, } diff --git a/deployment/puppet/nailgun/manifests/cobbler.pp b/deployment/puppet/nailgun/manifests/cobbler.pp index a6309e9d24..6d08fa9a90 100644 --- a/deployment/puppet/nailgun/manifests/cobbler.pp +++ b/deployment/puppet/nailgun/manifests/cobbler.pp @@ -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, diff --git a/deployment/puppet/nailgun/manifests/host.pp b/deployment/puppet/nailgun/manifests/host.pp index 5e1a10dfbb..8a0b18beac 100644 --- a/deployment/puppet/nailgun/manifests/host.pp +++ b/deployment/puppet/nailgun/manifests/host.pp @@ -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', + } + } diff --git a/deployment/puppet/nailgun/manifests/init.pp b/deployment/puppet/nailgun/manifests/init.pp index a43bdb3a39..dfe7eed630 100644 --- a/deployment/puppet/nailgun/manifests/init.pp +++ b/deployment/puppet/nailgun/manifests/init.pp @@ -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, diff --git a/deployment/puppet/cobbler/templates/dhcp-enter-hooks.erb b/deployment/puppet/nailgun/templates/dhcp-enter-hooks.erb similarity index 100% rename from deployment/puppet/cobbler/templates/dhcp-enter-hooks.erb rename to deployment/puppet/nailgun/templates/dhcp-enter-hooks.erb diff --git a/deployment/puppet/nailgun/templates/resolv.conf.erb b/deployment/puppet/nailgun/templates/resolv.conf.erb new file mode 100644 index 0000000000..311033ba02 --- /dev/null +++ b/deployment/puppet/nailgun/templates/resolv.conf.erb @@ -0,0 +1,3 @@ +search <%= @dns_search %> +domain <%= @domain %> +nameserver <%= @cobbler_host %>