]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Move nas and vm definitions into subsystems
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 12 Sep 2015 00:45:31 +0000 (21:45 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 12 Sep 2015 00:45:31 +0000 (21:45 -0300)
manifests/subsystem/nas/share.pp [moved from manifests/nas/share.pp with 98% similarity]
manifests/subsystem/vm/instance.pp [moved from manifests/vserver/instance.pp with 51% similarity]

similarity index 98%
rename from manifests/nas/share.pp
rename to manifests/subsystem/nas/share.pp
index 1aec8987229434b174e6f1973ba62460aa654a12..43922b7ef31acfa166f16c68fc328f6b8a554659 100644 (file)
@@ -1,5 +1,5 @@
 # Share a folder pubicly using FTP, Samba, NFS, DLNA, etc.
-define nodo::nas::share(
+define nodo::subsystem::nas::share(
   $description,
   $folder,
   $owner                = '',
similarity index 51%
rename from manifests/vserver/instance.pp
rename to manifests/subsystem/vm/instance.pp
index 23cebb17cc5a86719a1eb4ea87bee21b51f717dc..4a2bfeba90774104c8970ab90c83bf42488170c3 100644 (file)
@@ -1,5 +1,5 @@
 # Define a vserver instance
-define nodo::vserver::instance(
+define nodo::subsystem::vm::instance(
  $context,
  $distro                = 'squeeze',
  $ensure                = 'running',
@@ -20,7 +20,8 @@ define nodo::vserver::instance(
  $rsync                 = false,
  $avahi                 = false,
  $munin_port            = false,
- $monkeysphere_ssh_port = false
+ $monkeysphere_ssh_port = false,
+ $implementation        = false
 ) {
 
   # Instance id
@@ -45,29 +46,49 @@ define nodo::vserver::instance(
     '': { $tor_port = "9001" }
   }
 
-  $dev = hiera('nodo::vserver::interface', 'eth0')
+  $dev = hiera('nodo::subsystem::vm::interface', 'eth0')
+
+  if $implementation == 'vserver' {
+    virtual::vserver { $name:
+      ensure       => $ensure,
+      context      => "$context",
+      mark         => 'default',
+      distro       => $distro,
+      interface    => "${dev}:192.168.0.${context}/24",
+      hostname     => "$name.$domain",
+      memory_limit => $memory_limit,
+    }
 
-  virtual::vserver { $name:
-    ensure       => $ensure,
-    context      => "$context",
-    mark         => 'default',
-    distro       => $distro,
-    interface    => "${dev}:192.168.0.${context}/24",
-    hostname     => "$name.$domain",
-    memory_limit => $memory_limit,
-  }
+    # Some nodes need a lot of space at /tmp otherwise some admin
+    # tasks like backups might not run.
+    file { "/etc/vservers/${name}/fstab":
+      source  => [ "puppet:///modules/site_nodo/etc/fstab/vserver/$name",
+                   "puppet:///modules/nodo/etc/fstab/vserver" ],
+      owner   => "root",
+      group   => "root",
+      mode    => 0644,
+      ensure  => present,
+      notify  => Exec["vs_restart_${name}"],
+      require => Exec["vs_create_${name}"],
+    }
 
-  # Some nodes need a lot of space at /tmp otherwise some admin
-  # tasks like backups might not run.
-  file { "/etc/vservers/${name}/fstab":
-    source  => [ "puppet:///modules/site_nodo/etc/fstab/vserver/$name",
-                 "puppet:///modules/nodo/etc/fstab/vserver" ],
-    owner   => "root",
-    group   => "root",
-    mode    => 0644,
-    ensure  => present,
-    notify  => Exec["vs_restart_${name}"],
-    require => Exec["vs_create_${name}"],
+    # Sound support
+    if $sound {
+      if !defined(File["/usr/local/sbin/create-sound-devices"]) {
+        file { "/usr/local/sbin/create-sound-devices":
+          ensure => present,
+          source => "puppet:///modules/nodo/sound/devices.sh",
+          owner  => root,
+          group  => root,
+          mode   => 755,
+        }
+      }
+      exec { "/usr/local/sbin/create-sound-devices ${name}":
+        unless  => "/usr/local/sbin/create-sound-devices ${name} --check",
+        user    => root,
+        require => [ Exec["vs_create_${name}"], File["/usr/local/sbin/create-sound-devices"] ],
+      }
+    }
   }
 
   # Create a munin virtual resource to be realized in the node
@@ -86,34 +107,16 @@ define nodo::vserver::instance(
     }
   }
 
-  # Sound support
-  if $sound {
-    if !defined(File["/usr/local/sbin/create-sound-devices"]) {
-      file { "/usr/local/sbin/create-sound-devices":
-        ensure => present,
-        source => "puppet:///modules/nodo/sound/devices.sh",
-        owner  => root,
-        group  => root,
-        mode   => 755,
-      }
-    }
-    exec { "/usr/local/sbin/create-sound-devices ${name}":
-      unless  => "/usr/local/sbin/create-sound-devices ${name} --check",
-      user    => root,
-      require => [ Exec["vs_create_${name}"], File["/usr/local/sbin/create-sound-devices"] ],
-    }
-  }
-
   # Apply firewall rules just for running vservers
   case $ensure {
     'running': {
-      firewall::vserver::ssh { "$name":
+      firewall::vm::ssh { "$name":
         destination => "192.168.0.$context",
         port_orig => "22$id",
         port_dest => "22",
       }
 
-      firewall::vserver::munin { "$name":
+      firewall::vm::munin { "$name":
         destination => "192.168.0.$context",
         port_orig   => "49$id",
         port_dest   => "49$id",
@@ -121,14 +124,14 @@ define nodo::vserver::instance(
 
       if $proxy {
         class {
-          "firewall::vserver::http":  destination => "192.168.0.$context";
-          "firewall::vserver::https": destination => "192.168.0.$context";
+          "firewall::vm::http":  destination => "192.168.0.$context";
+          "firewall::vm::https": destination => "192.168.0.$context";
         }
       }
 
       if $puppetmaster {
         class {
-          "firewall::vserver::puppetmaster":
+          "firewall::vm::puppetmaster":
             destination              => "192.168.0.$context",
             puppetmaster_port        => $puppetmaster_port,
             puppetmaster_nonssl_port => $puppetmaster_nonssl_port,
@@ -137,67 +140,67 @@ define nodo::vserver::instance(
 
       if $gitd {
         class {
-          "firewall::vserver::gitd": destination => "192.168.0.$context";
+          "firewall::vm::gitd": destination => "192.168.0.$context";
         }
       }
 
       if $icecast {
         class {
-          "firewall::vserver::icecast": destination => "192.168.0.$context";
+          "firewall::vm::icecast": destination => "192.168.0.$context";
         }
       }
 
       if $mail {
         class {
-          "firewall::vserver::mail": destination => "192.168.0.$context";
+          "firewall::vm::mail": destination => "192.168.0.$context";
         }
       }
 
       if $dns {
         class {
-          "firewall::vserver::dns": destination => "192.168.0.$context";
+          "firewall::vm::dns": destination => "192.168.0.$context";
         }
       }
 
       if $tor {
         class {
-          "firewall::vserver::tor": destination => "192.168.0.$context";
+          "firewall::vm::tor": destination => "192.168.0.$context";
         }
       }
 
       if $jabber {
         class {
-          "firewall::vserver::jabber": destination => "192.168.0.$context";
+          "firewall::vm::jabber": destination => "192.168.0.$context";
         }
       }
 
       if $mumble {
         class {
-          "firewall::vserver::mumble": destination => "192.168.0.$context";
+          "firewall::vm::mumble": destination => "192.168.0.$context";
         }
       }
 
       if $gobby {
         class {
-          "firewall::vserver::gobby": destination => "192.168.0.$context";
+          "firewall::vm::gobby": destination => "192.168.0.$context";
         }
       }
 
       if $yacy {
         class {
-          "firewall::vserver::yacy": destination => "192.168.0.$context";
+          "firewall::vm::yacy": destination => "192.168.0.$context";
         }
       }
 
       if $rsync {
         class {
-          "firewall::vserver::rsync": destination => "192.168.0.$context";
+          "firewall::vm::rsync": destination => "192.168.0.$context";
         }
       }
 
       if $avahi {
         class {
-          "firewall::vserver::mdns": destination => "192.168.0.$context";
+          "firewall::vm::mdns": destination => "192.168.0.$context";
         }
       }
     }