]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Adding $nodo_custom_hosts_file parameter
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 5 Feb 2012 22:54:35 +0000 (20:54 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 5 Feb 2012 22:54:35 +0000 (20:54 -0200)
manifests/subsystems/hosts.pp

index 00990f4b4d76691df95e159d5614df035f2e60ce..be3d405c65d7038a276094d4bf3d748a0cb12ee0 100644 (file)
@@ -1,43 +1,58 @@
 class hosts {
-  host { "$hostname":
-    ensure       => present,
-    ip           => "$ipaddress",
-    host_aliases => [ "$fqdn" ],
-  }
-
-  host { "localhost":
-    ensure => present,
-    ip     => "127.0.0.1",
-  }
-
-  host { "ip6-localhost":
-    ensure       => present,
-    ip           => "::1",
-    host_aliases => [ "ip6-loopback" ],
-  }
-
-  host { "ip6-localnet":
-    ensure => present,
-    ip     => "fe00::0",
-  }
-
-  host { "ip6-mcastprefix":
-    ensure => present,
-    ip     => "ff00::0",
-  }
-
-  host { "ip6-allnodes":
-    ensure => present,
-    ip     => "ff02::1",
-  }
-
-  host { "ip6-allrouters":
-    ensure => present,
-    ip     => "ff02::2",
-  }
-
-  host { "ip6-allhosts":
-    ensure => present,
-    ip     => "ff02::3",
+  # Sometimes might be useful to manage the whole
+  # hosts file, see http://projects.puppetlabs.com/issues/10704
+  case $nodo_custom_hosts_file {
+    true: {
+      file { '/etc/hosts':
+        ensure => present,
+        owner  => root,
+        group  => root,
+        mode   => 0640,
+        source => "puppet:///modules/site-nodo/hosts/$fqdn",
+      }
+    }
+    default: {
+      host { "$hostname":
+        ensure       => present,
+        ip           => "$ipaddress",
+        host_aliases => [ "$fqdn" ],
+      }
+    
+      host { "localhost":
+        ensure => present,
+        ip     => "127.0.0.1",
+      }
+    
+      host { "ip6-localhost":
+        ensure       => present,
+        ip           => "::1",
+        host_aliases => [ "ip6-loopback" ],
+      }
+    
+      host { "ip6-localnet":
+        ensure => present,
+        ip     => "fe00::0",
+      }
+    
+      host { "ip6-mcastprefix":
+        ensure => present,
+        ip     => "ff00::0",
+      }
+    
+      host { "ip6-allnodes":
+        ensure => present,
+        ip     => "ff02::1",
+      }
+    
+      host { "ip6-allrouters":
+        ensure => present,
+        ip     => "ff02::2",
+      }
+    
+      host { "ip6-allhosts":
+        ensure => present,
+        ip     => "ff02::3",
+      }
+    }
   }
 }