Skip to content
Snippets Groups Projects
Commit f991e8a4 authored by elijah's avatar elijah
Browse files

clean up how /etc/hosts is generated so it doesn't require custom behavior...

clean up how /etc/hosts is generated so it doesn't require custom behavior depending on the services.
parent 79295764
Branches
Tags
No related merge requests found
class site_config::default { class site_config::default {
tag 'leap_base' tag 'leap_base'
$services = hiera('services', [])
$domain_hash = hiera('domain') $domain_hash = hiera('domain')
include site_config::params include site_config::params
...@@ -54,7 +55,7 @@ class site_config::default { ...@@ -54,7 +55,7 @@ class site_config::default {
# set up core leap files and directories # set up core leap files and directories
include site_config::files include site_config::files
if $::services !~ /\bmx\b/ { if ! member($services, 'mx') {
include site_postfix::satellite include site_postfix::satellite
} }
......
class site_config::hosts() { class site_config::hosts() {
$hosts = hiera('hosts', false) $hosts = hiera('hosts', false)
# calculate all the hostname aliases that might be used
$hostname = hiera('name') $hostname = hiera('name')
$domain_hash = hiera('domain') $domain_hash = hiera('domain', {})
$domain_public = $domain_hash['full_suffix'] $dns = hiera('dns', {})
$api = hiera('api', '') if $dns['aliases'] == undef {
$dns_aliases = []
} else {
$dns_aliases = $dns['aliases']
}
$my_hostnames = unique(sort(concat(
[$hostname, $domain_hash['full'], $domain_hash['internal']],
$dns_aliases
)))
file { '/etc/hostname': file { '/etc/hostname':
ensure => present, ensure => present,
......
...@@ -4,7 +4,6 @@ class site_config::setup { ...@@ -4,7 +4,6 @@ class site_config::setup {
# #
# this is applied before each run of site.pp # this is applied before each run of site.pp
# #
#$services = ''
Exec { path => '/usr/bin:/usr/sbin/:/bin:/sbin:/usr/local/bin:/usr/local/sbin' } Exec { path => '/usr/bin:/usr/sbin/:/bin:/sbin:/usr/local/bin:/usr/local/sbin' }
...@@ -13,10 +12,6 @@ class site_config::setup { ...@@ -13,10 +12,6 @@ class site_config::setup {
include concat::setup include concat::setup
include stdlib include stdlib
# parse services for host
$services=join(hiera_array('services', ['']), ' ')
# configure /etc/hosts # configure /etc/hosts
class { 'site_config::hosts': class { 'site_config::hosts':
stage => setup, stage => setup,
......
# This file is managed by puppet, any changes will be overwritten! # This file is managed by puppet, any changes will be overwritten!
127.0.0.1 localhost 127.0.0.1 localhost
127.0.1.1 <%= @hostname %>.<%= @domain_public %> <%= @hostname %> <% if (defined? @services) and (@services.include? 'webapp') -%><%= @domain_public %> <%= @api['domain'] %><% end -%> 127.0.1.1 <%= @my_hostnames.join(' ') %>
<%- if @hosts then -%> <%- if @hosts then -%>
<% @hosts.keys.sort.each do |name| -%> <% @hosts.keys.sort.each do |name| -%>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment