Skip to content

Commit

Permalink
Initial Puppet module
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmer committed Jun 9, 2013
1 parent 038e066 commit 076a174
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Puppetfile
@@ -0,0 +1,2 @@
mod 'git',
:git => "git://github.com/anchor/puppet-git"
40 changes: 40 additions & 0 deletions README.puppet
@@ -0,0 +1,40 @@
# Giddyup!

Giddyup is a git-based software deployment tool. See
http://theshed.hezmatt.org/giddyup for more info.

This is a basic module to install giddyup and provide you the ability to
create new giddyup environments.


## Usage

To setup a giddyup environment to deploy to, use the giddyup
type, like this:

giddyup { "/some/base/directory":
environment => "production",
hookdir => "config/hooks",
keepreleases => "5",
debug => "false",
user => "someone"
}

The namevar is the directory to be giddyupified; any giddyup configuration
variable is allowed as an attribute. The only other attribute allowed is
'user', which specifies the user that the deployment tree will be owned by.

There is nothing else to it.


## Dependencies

This module depends on the 'git' module to install git so we can configure
the giddyup deployment environment, and also because it's a bit hard to use
git without having git installed.


## Compatibility

Should be fairly distribution-agnostic. Only tested on Debian Squeeze so
far.
1 change: 1 addition & 0 deletions files/functions.sh
1 change: 1 addition & 0 deletions files/giddyup
1 change: 1 addition & 0 deletions files/update-hook
14 changes: 14 additions & 0 deletions manifests/config.pp
@@ -0,0 +1,14 @@
define giddyup::config($base,
$user,
$var,
$value = undef) {
if $value {
exec { "set giddyup.${var} in ${base}":
command => "/usr/bin/git config -f '${base}/repo/config' 'giddyup.${var}' '${value}'",
unless => "/usr/bin/test \"\$(git config -f ${base}/repo/config giddyup.${var})\" = '${value}'",
cwd => "/",
user => $user,
require => [ Noop["git/installed"], Exec["giddyup create ${base}"], User[$user] ]
}
}
}
38 changes: 38 additions & 0 deletions manifests/init.pp
@@ -0,0 +1,38 @@
define giddyup($environment = undef,
$hookdir = undef,
$keepreleases = undef,
$debug = undef,
$user) {
include giddyup::install
include git::packages

exec { "giddyup create ${name}":
command => "/usr/local/lib/giddyup/giddyup ${name}",
creates => $name,
user => $user,
require => [ File["/usr/local/lib/giddyup/giddyup"], User[$user] ]
}

giddyup::config {
"giddyup.environment for ${name}":
base => $name,
user => $user,
var => "environment",
value => $environment;
"giddyup.hookdir for ${name}":
base => $name,
user => $user,
var => "hookdir",
value => $hookdir;
"giddyup.keepreleases for ${name}":
base => $name,
user => $user,
var => "keepreleases",
value => $keepreleases;
"giddyup.debug for ${name}":
base => $name,
user => $user,
var => "debug",
value => $debug;
}
}
19 changes: 19 additions & 0 deletions manifests/install.pp
@@ -0,0 +1,19 @@
class giddyup::install {
file {
"/usr/local/lib/giddyup":
ensure => directory,
mode => 0755;
"/usr/local/lib/giddyup/giddyup":
source => "puppet:///modules/giddyup/giddyup",
mode => 0555,
require => [ File["/usr/local/lib/giddyup/update-hook"],
File["/usr/local/lib/giddyup/functions.sh"]
];
"/usr/local/lib/giddyup/update-hook":
source => "puppet:///modules/giddyup/update-hook",
mode => 0555;
"/usr/local/lib/giddyup/functions.sh":
source => "puppet:///modules/giddyup/functions.sh",
mode => 0444;
}
}

0 comments on commit 076a174

Please sign in to comment.