]> gitweb.fluxo.info Git - puppet-bootstrap.git/commitdiff
New submodule scheme
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 22:26:55 +0000 (19:26 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 28 Feb 2014 22:26:55 +0000 (19:26 -0300)
13 files changed:
README.md
bin/mrconfig [moved from misc/mrconfig.sh with 100% similarity]
bin/submodules [new file with mode: 0755]
files/.empty [new file with mode: 0644]
manifests/classes/admin_node.pp [deleted file]
manifests/classes/firewall.pp [deleted file]
manifests/classes/puppet_bootstrap.pp [deleted file]
manifests/classes/puppetmasterd.pp [deleted file]
manifests/host.pp
manifests/master.pp
manifests/nodes/.empty [new file with mode: 0644]
manifests/repository.pp
templates/bin/puppet-bootstrap [deleted file]

index 3f7262f89cca5125bb3284fa7f67faec934c1ad9..414987f17ece3cfc638fdd631d29824794d757a1 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,5 +5,24 @@ This is a multi-purpose but very specific puppet module which can be used:
 
 * As the base repository for a puppet infostructure.
 * As a standalone provisioner for boxes, with Vagrant support.
-* It can be optionally used together with the Hydra Suite from
-  https://git.sarava.org/?p=hydra.git
+* It can be optionally used together with the Hydra Suite from https://git.sarava.org/?p=hydra.git
+
+Setting up a new puppetmaster repository
+----------------------------------------
+
+You'll basically use the `bootstrap` repository as your `puppet` repository:
+
+    git clone git://git.sarava.org/puppet-bootstrap.git puppet
+    cd puppet && git tag -v
+    bin/submodules # get all needed submodules
+
+Using as a standalone provisioner
+---------------------------------
+
+This will be a `Vagrant` example:
+
+    cd your-project
+    git clone git://git.sarava.org/puppet-bootstrap.git puppet # use submodule or subtree as you please
+    ln -s puppet/Vagrantfile .                                 # or copy if you want to customize
+    ( cd puppet && mr up )                                     # need the mr binary to download the submodules
+    vagrant up
similarity index 100%
rename from misc/mrconfig.sh
rename to bin/mrconfig
diff --git a/bin/submodules b/bin/submodules
new file mode 100755 (executable)
index 0000000..c33e74e
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Setup submodules.
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+
+# Usage
+function usage {
+  echo "Usage: $1 add-submodules <DIR>"
+  exit $2
+}
+
+# Get module list
+repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`"
+
+# Add submodules
+for repo in $repos; do
+  module="`basename $repo .git | sed -e s/^puppet-//`"
+  if [ ! -d "modules/$module" ]; then
+    git submodule add $repo modules/$module
+  fi
+done
+
+# Update all modules
+git submodule update --init
diff --git a/files/.empty b/files/.empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/manifests/classes/admin_node.pp b/manifests/classes/admin_node.pp
deleted file mode 100644 (file)
index 22b08fd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-class admin_node {
-  nodo::vserver::instance { "$hostname-master":
-    context      => '2',
-    puppetmaster => true,
-  }
-
-  host { "puppet":
-    ensure       => present,
-    ip           => "192.168.0.2",
-    host_aliases => [ "puppet.$domain", "admin" ],
-  }
-}
diff --git a/manifests/classes/firewall.pp b/manifests/classes/firewall.pp
deleted file mode 100644 (file)
index cd1b225..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-class firewall {
-  include shorewall
-
-  shorewall::rule { "ssh-02":
-    action          => 'DNAT',
-    source          => 'net',
-    destination     => "vm:192.168.0.2:22",
-    proto           => 'tcp',
-    destinationport => "2202",
-    ratelimit       => '-',
-    order           => "202",
-  }
-}
diff --git a/manifests/classes/puppet_bootstrap.pp b/manifests/classes/puppet_bootstrap.pp
deleted file mode 100644 (file)
index d0517f7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-class puppet_bootstrap {
-
-  $templates_dir = "$puppet_bootstrap_tmpdir/templates"
-
-  # puppet-bootstrap script
-  file { "/usr/local/sbin/puppet-bootstrap":
-    owner   => "root",
-    group   => "root",
-    mode    => 0755,
-    ensure  => present,
-    content => template("$templates_dir/bin/puppet-bootstrap"),
-  }
-
-  package { "lynx": ensure => installed }
-
-  define puppet_modules($puppet_dir) {
-
-    # directory to download modules
-    file { "$puppet_dir/modules":
-      ensure  => directory,
-      owner   => "puppet",
-      group   => "puppet",
-      mode    => 0755,
-    }
-
-     # execute the bootstrap script to download puppet modules
-    exec { "/usr/local/sbin/puppet-bootstrap add-submodules $puppet_dir":
-      user    => root,
-      require => [ File["/usr/local/sbin/puppet-bootstrap"], File["$puppet_dir/modules"] ],
-      timeout => 600,
-    }
-
-  }
-
-}
diff --git a/manifests/classes/puppetmasterd.pp b/manifests/classes/puppetmasterd.pp
deleted file mode 100644 (file)
index 5aaebb7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-class puppetmasterd {
-
-  package { "puppetmaster": ensure => installed, }
-
-  # updates the puppet configuration dir with git repositories
-  # every 5 minutes.
-  cron { puppet-conf:
-    command => "git --git-dir=/etc/puppet/.git/ pull /var/git/repositories/puppet.git master && \
-                git --git-dir=/etc/puppet/.git/ --work-tree=/etc/puppet/ checkout -f",
-    user    => root,
-    hour    => '*',
-    minute  => '*/5',
-    ensure  => present,
-  }
-
-  # runs the service
-  service { "puppetmasterd":
-    ensure => stopped,
-    depends => Package["puppetmaster"],
-  }
-}
index eaa9e22f339e16b0f46c77425d17fc4869512e6c..eecb81ebef63e0cf43c5e89a07febdbf0d5a7952 100644 (file)
@@ -1,5 +1,5 @@
 #
-# This file is intended to configure the initial
+# This manifest is intended to configure the initial
 # machine wich will host the first puppetmaster
 # virtual machine.
 #
@@ -16,7 +16,14 @@ import "classes/default_conf.pp"
 include nodo::role::server
 
 # Creates vserver for administrative node
-include admin_node
+nodo::vserver::instance { "$hostname-master":
+  context      => '2',
+  puppetmaster => true,
+}
 
-# Creates firewall rules for administrative node's external acess
-include firewall
+# Create a host entry for this puppet node
+host { "puppet":
+  ensure       => present,
+  ip           => "192.168.0.2",
+  host_aliases => [ "puppet.$domain", "admin" ],
+}
index 30f6dc2c8ad1a36d0f39ab71ae0a1592f4a3a9b8..0b645237a6fc4e220d744fdc3009222663d5ea01 100644 (file)
@@ -1,5 +1,5 @@
 #
-# This file is intended to configure the initial
+# This manifest is intended to configure the initial
 # puppetmaster node.
 #
 # Once it's running it can setup all the other nodes.
diff --git a/manifests/nodes/.empty b/manifests/nodes/.empty
new file mode 100644 (file)
index 0000000..e69de29
index b1489330adeb3708235c94a41d8b6e8222812bd9..9564123df62e77ad7e3bff6eab2cf2d7a183bb2c 100644 (file)
@@ -1,7 +1,13 @@
+#
+# This manifest is intended to generate the initial
+# puppet repository.
+#
+
+# Import the needed config and modules
 import "config.pp"
 import "classes/puppet_bootstrap.pp"
 
-# setup modules for use with other stages
+# Setup modules for use with other stages
 include puppet_bootstrap
 
 puppet_bootstrap::puppet_modules{ "modules":
diff --git a/templates/bin/puppet-bootstrap b/templates/bin/puppet-bootstrap
deleted file mode 100644 (file)
index b2b8eca..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-function usage {
-  echo "Usage: $1 add-submodules <DIR>"
-  exit $2
-}
-
-function add_submodules {
-  cd $1
-  git init
-  git add .
-  mkdir -p ./modules
-  
-  repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`"
-  for repo in $repos; do
-    module="`basename $repo .git | sed -e s/^puppet-//`"
-    if [ ! -d "modules/$module" ]; then
-      git submodule add git://git.sarava.org/puppet-$module.git modules/$module
-    fi
-  done
-
-  git submodule update --init
-}
-
-if [ $# -ne 2 ]; then
-  usage $0 1
-  exit 1
-fi
-
-case $1 in
-  add-submodules) add_submodules $2;;
-  help) usage $0 0 ;;
-  *) usage $0 1; exit 1 ;;
-esac