aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-28 19:26:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-02-28 19:26:55 -0300
commitc154a1076a6145a28133e9417d842310335d6805 (patch)
treeef16d294172fd448c8291442d13f5b32efe949ff
parentd2331dfe6d46e7e1f824e7692828411e4b7d7d28 (diff)
downloadpuppet-bootstrap-c154a1076a6145a28133e9417d842310335d6805.tar.gz
puppet-bootstrap-c154a1076a6145a28133e9417d842310335d6805.tar.bz2
New submodule scheme
-rw-r--r--README.md23
-rwxr-xr-xbin/mrconfig (renamed from misc/mrconfig.sh)0
-rwxr-xr-xbin/submodules27
-rw-r--r--files/.empty0
-rw-r--r--manifests/classes/admin_node.pp12
-rw-r--r--manifests/classes/firewall.pp13
-rw-r--r--manifests/classes/puppet_bootstrap.pp35
-rw-r--r--manifests/classes/puppetmasterd.pp21
-rw-r--r--manifests/host.pp15
-rw-r--r--manifests/master.pp2
-rw-r--r--manifests/nodes/.empty0
-rw-r--r--manifests/repository.pp8
-rw-r--r--templates/bin/puppet-bootstrap34
13 files changed, 67 insertions, 123 deletions
diff --git a/README.md b/README.md
index 3f7262f..414987f 100644
--- 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
diff --git a/misc/mrconfig.sh b/bin/mrconfig
index ffb0438..ffb0438 100755
--- a/misc/mrconfig.sh
+++ b/bin/mrconfig
diff --git a/bin/submodules b/bin/submodules
new file mode 100755
index 0000000..c33e74e
--- /dev/null
+++ b/bin/submodules
@@ -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
index 0000000..e69de29
--- /dev/null
+++ b/files/.empty
diff --git a/manifests/classes/admin_node.pp b/manifests/classes/admin_node.pp
deleted file mode 100644
index 22b08fd..0000000
--- a/manifests/classes/admin_node.pp
+++ /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
index cd1b225..0000000
--- a/manifests/classes/firewall.pp
+++ /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
index d0517f7..0000000
--- a/manifests/classes/puppet_bootstrap.pp
+++ /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
index 5aaebb7..0000000
--- a/manifests/classes/puppetmasterd.pp
+++ /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"],
- }
-}
diff --git a/manifests/host.pp b/manifests/host.pp
index eaa9e22..eecb81e 100644
--- a/manifests/host.pp
+++ b/manifests/host.pp
@@ -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" ],
+}
diff --git a/manifests/master.pp b/manifests/master.pp
index 30f6dc2..0b64523 100644
--- a/manifests/master.pp
+++ b/manifests/master.pp
@@ -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
index 0000000..e69de29
--- /dev/null
+++ b/manifests/nodes/.empty
diff --git a/manifests/repository.pp b/manifests/repository.pp
index b148933..9564123 100644
--- a/manifests/repository.pp
+++ b/manifests/repository.pp
@@ -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
index b2b8eca..0000000
--- a/templates/bin/puppet-bootstrap
+++ /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