aboutsummaryrefslogtreecommitdiff
path: root/hydra
blob: 46a2e5bdd260a633f66c148006f64c9151074006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#
# Hydra Process Command Tool.
#
# Copyright (C) 2010 Sarava Group - sarava at lists.riseup.net
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# TODO: get all needed requirements
function hydra_requirements {
}

# TODO: check debian version and if backports is enabled
# TODO: check backports key signature
function hydra_backports {
  echo "deb http://www.backports.org/debian lenny-backports main contrib non-free" >> /etc/apt/sources.list
  apt-get update ; apt-get install debian-backports-keyring ; apt-get update
  apt-get -t lenny-backports install puppet puppetmaster
}

function hydra_install_puppet {
  apt-get update
  # TODO: use option '-t lenny-backports' if installing from backports
  apt-get install puppet puppetmaster
}

# Initializes a new hydra from scratch
function hydra_init {
  hydra_backports
  hydra_install_puppet

  mkdir -p /etc/puppet/modules
  git clone git://git.sarava.org/puppet-bootstrap /etc/puppet/modules/bootstrap

  # TODO: edit /etc/puppet/modules/bootstrap/manifests/site.pp to suit your needs.

  puppetd --no-daemonize --debug --verbose --onetime /etc/puppet/modules/bootstrap/manifests/init.pp
  puppetd --no-daemonize --debug --verbose
}

# Register an existing hydra
function hydra_register {
  # TODO
}

# Command-line parameters
COMMAND="$1"
BASENAME="`basename $0`"

# Command-line parser
if [ -z "$COMMAND" ]; then
  echo "usage: $BASENAME <comman> [arguments]"
fi

# Dispatch
hydra_requirements
hydra_$COMMAND