* 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
--- /dev/null
+#!/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
+++ /dev/null
-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" ],
- }
-}
+++ /dev/null
-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",
- }
-}
+++ /dev/null
-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,
- }
-
- }
-
-}
+++ /dev/null
-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"],
- }
-}
#
-# 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.
#
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" ],
+}
#
-# 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.
+#
+# 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":
+++ /dev/null
-#!/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