summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/manifests/hosts.pp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2012-12-11 15:37:15 -0500
committerMicah Anderson <micah@riseup.net>2012-12-11 15:41:17 -0500
commitcbb834da5de7e2abe7399e34766492bfab48fa9c (patch)
tree23fee326a81aa7473731446b59322e5df7525ed8 /puppet/modules/site_config/manifests/hosts.pp
parent090dca27921efe22fdc39c8598356bfb74e5fe99 (diff)
test to see if the hosts value is empty before trying to reference it in a template
also set the hostname to what the hiera 'name' is set to
Diffstat (limited to 'puppet/modules/site_config/manifests/hosts.pp')
-rw-r--r--puppet/modules/site_config/manifests/hosts.pp10
1 files changed, 10 insertions, 0 deletions
diff --git a/puppet/modules/site_config/manifests/hosts.pp b/puppet/modules/site_config/manifests/hosts.pp
index 08890a5d..5269bf35 100644
--- a/puppet/modules/site_config/manifests/hosts.pp
+++ b/puppet/modules/site_config/manifests/hosts.pp
@@ -1,5 +1,15 @@
class site_config::hosts {
+ $hosts = hiera('hosts','')
+ $hostname = hiera('name')
+
+ exec { "/bin/hostname $hostname ": }
+
+ file { "/etc/hostname":
+ ensure => present,
+ content => $hostname
+ }
+
file { '/etc/hosts':
content => template('site_config/hosts'),
mode => '0644', owner => root, group => root;