From 3cc5e2e928b982b1750439a58a9fac6e1100129a Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Tue, 9 Jul 2013 22:12:54 +0000 Subject: [PATCH] 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. --- manifests/init.pp | 2 ++ manifests/nameresolution.pp | 16 ++++++++++++++++ manifests/params.pp | 5 +++++ 3 files changed, 23 insertions(+) create mode 100644 manifests/nameresolution.pp diff --git a/manifests/init.pp b/manifests/init.pp index c1d5e43..ff95d85 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 } diff --git a/manifests/nameresolution.pp b/manifests/nameresolution.pp new file mode 100644 index 0000000..d498b74 --- /dev/null +++ b/manifests/nameresolution.pp @@ -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" |>> { } + } + } +} + diff --git a/manifests/params.pp b/manifests/params.pp index eff399c..d138385 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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'))