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/templates/hosts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 puppet/modules/site_config/templates/hosts (limited to 'puppet/modules/site_config/templates/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 From cbb834da5de7e2abe7399e34766492bfab48fa9c Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 11 Dec 2012 15:37:15 -0500 Subject: 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 --- puppet/modules/site_config/templates/hosts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'puppet/modules/site_config/templates/hosts') diff --git a/puppet/modules/site_config/templates/hosts b/puppet/modules/site_config/templates/hosts index 1a12addc..c516eaf8 100644 --- a/puppet/modules/site_config/templates/hosts +++ b/puppet/modules/site_config/templates/hosts @@ -1,7 +1,9 @@ # This file is managed by puppet, any changes will be overwritten! -127.0.0.1 localhost -<%= scope.function_hiera('hosts') %> +127.0.0.1 localhost +<%- if hosts.to_s != '' then -%> +<%= hosts %> +<% end -%> # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback -- cgit v1.2.3 From fc59f6c6a22a4659cefa29e18a658c852c6e89f7 Mon Sep 17 00:00:00 2001 From: varac Date: Sun, 20 Jan 2013 14:09:50 +0100 Subject: configure fqdn for host --- puppet/modules/site_config/templates/hosts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'puppet/modules/site_config/templates/hosts') diff --git a/puppet/modules/site_config/templates/hosts b/puppet/modules/site_config/templates/hosts index c516eaf8..05fb56b9 100644 --- a/puppet/modules/site_config/templates/hosts +++ b/puppet/modules/site_config/templates/hosts @@ -1,6 +1,8 @@ # This file is managed by puppet, any changes will be overwritten! 127.0.0.1 localhost +127.0.1.1 <%= hostname %>.<%= domain %> <%= hostname %> + <%- if hosts.to_s != '' then -%> <%= hosts %> <% end -%> -- cgit v1.2.3 From d7f7bad9b6d4a45aa06c74a1f630b38a534092e0 Mon Sep 17 00:00:00 2001 From: varac Date: Sun, 20 Jan 2013 15:26:26 +0100 Subject: configure fqdn for host --- puppet/modules/site_config/templates/hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'puppet/modules/site_config/templates/hosts') diff --git a/puppet/modules/site_config/templates/hosts b/puppet/modules/site_config/templates/hosts index 05fb56b9..00cc6a79 100644 --- a/puppet/modules/site_config/templates/hosts +++ b/puppet/modules/site_config/templates/hosts @@ -1,7 +1,7 @@ # This file is managed by puppet, any changes will be overwritten! 127.0.0.1 localhost -127.0.1.1 <%= hostname %>.<%= domain %> <%= hostname %> +127.0.1.1 <%= hostname %>.<%= @domain_public %> <%= hostname %> <%- if hosts.to_s != '' then -%> <%= hosts %> -- cgit v1.2.3