From 090dca27921efe22fdc39c8598356bfb74e5fe99 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 11 Dec 2012 13:10:30 -0500 Subject: setup /etc/hosts based on a template and the hiera value 'hosts' This will replace the existing /etc/hosts, so we will want to make this more smart later --- puppet/modules/site_config/manifests/hosts.pp | 7 +++++++ puppet/modules/site_config/manifests/init.pp | 3 +++ puppet/modules/site_config/templates/hosts | 11 +++++++++++ 3 files changed, 21 insertions(+) create mode 100644 puppet/modules/site_config/manifests/hosts.pp create mode 100644 puppet/modules/site_config/templates/hosts (limited to 'puppet/modules') diff --git a/puppet/modules/site_config/manifests/hosts.pp b/puppet/modules/site_config/manifests/hosts.pp new file mode 100644 index 00000000..08890a5d --- /dev/null +++ b/puppet/modules/site_config/manifests/hosts.pp @@ -0,0 +1,7 @@ +class site_config::hosts { + + file { '/etc/hosts': + content => template('site_config/hosts'), + mode => '0644', owner => root, group => root; + } +} diff --git a/puppet/modules/site_config/manifests/init.pp b/puppet/modules/site_config/manifests/init.pp index 7f67ad4e..268ff2fc 100644 --- a/puppet/modules/site_config/manifests/init.pp +++ b/puppet/modules/site_config/manifests/init.pp @@ -11,4 +11,7 @@ class site_config { # configure /etc/resolv.conf include site_config::resolvconf + + # configure /etc/hosts + include site_config::hosts } diff --git a/puppet/modules/site_config/templates/hosts b/puppet/modules/site_config/templates/hosts new file mode 100644 index 00000000..1a12addc --- /dev/null +++ b/puppet/modules/site_config/templates/hosts @@ -0,0 +1,11 @@ +# This file is managed by puppet, any changes will be overwritten! + +127.0.0.1 localhost +<%= scope.function_hiera('hosts') %> + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters -- cgit v1.2.3