Add a name resolution facility for hostnames

Make sure that hosts can always resolve each other's names.
For the moment, this simply uses exported /etc/hosts entries.
Less naive implementations could just export the address/hostname
tuples and feed them into a DNS server configuration.
This commit is contained in:
Florian Haas 2013-07-09 22:12:54 +00:00
parent 951ae08f0b
commit 3cc5e2e928
3 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,7 @@
class kickstack (
$fact_prefix = $kickstack::params::fact_prefix,
$fact_filename = $kickstack::params::fact_filename,
$name_resolution = $kickstack::params::name_resolution,
$verbose = $kickstack::params::verbose,
$debug = $kickstack::params::debug,
$database = $kickstack::params::database,
@ -57,4 +58,5 @@ class kickstack (
include exportfact
include openstack::repo
include kickstack::nameresolution
}

View File

@ -0,0 +1,16 @@
class kickstack::nameresolution inherits kickstack {
case $::kickstack::name_resolution {
'hosts': {
@@host { "$hostname":
ip => $ipaddress,
comment => "Managed by Puppet",
tag => "hostname"
}
Host <<| tag == "hostname" |>> { }
}
}
}

View File

@ -12,6 +12,11 @@ class kickstack::params {
# * override by setting "kickstack_fact_category"
$fact_category = pick(getvar("::${variable_prefix}fact_category"), "kickstack")
# The strategy to use so machines can make their hostnames known to
# each other.
# * default "hosts" -- manage /etc/hosts
$name_resolution = pick(getvar("::${variable_prefix}name_resolution"),"hosts")
# Enables verbose logging globally
$verbose = str2bool(pick(getvar("::${variable_prefix}verbose"), 'false'))