centostrano 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +215 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +166 -0
- data/THANKS +5 -0
- data/bin/centify +137 -0
- data/docs/ANNOUNCE.deprec2 +47 -0
- data/docs/README.install +88 -0
- data/docs/README.nagios +28 -0
- data/docs/README.rails +20 -0
- data/docs/README.svn +31 -0
- data/docs/ROADMAP.txt +74 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/deprec_banner.gif +0 -0
- data/lib/centostrano.rb +9 -0
- data/lib/deprec/capistrano_extensions.rb +391 -0
- data/lib/deprec/centostrano.rb +46 -0
- data/lib/deprec/recipes/apache.rb +188 -0
- data/lib/deprec/recipes/canonical.rb +57 -0
- data/lib/deprec/recipes/deprec.rb +188 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +106 -0
- data/lib/deprec/recipes/gitosis.rb +134 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/memcache.rb +53 -0
- data/lib/deprec/recipes/merb.rb +57 -0
- data/lib/deprec/recipes/mongrel.rb +220 -0
- data/lib/deprec/recipes/monit.rb +139 -0
- data/lib/deprec/recipes/mysql.rb +147 -0
- data/lib/deprec/recipes/nginx.rb +172 -0
- data/lib/deprec/recipes/postgresql.rb +132 -0
- data/lib/deprec/recipes/rails.rb +297 -0
- data/lib/deprec/recipes/ruby.rb +71 -0
- data/lib/deprec/recipes/sphinx.rb +89 -0
- data/lib/deprec/recipes/ssh.rb +93 -0
- data/lib/deprec/recipes/svn.rb +167 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes.rb +33 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +144 -0
- data/lib/deprec/templates/apache/httpd.conf +465 -0
- data/lib/deprec/templates/apache/index.html.erb +37 -0
- data/lib/deprec/templates/apache/master.css +72 -0
- data/lib/deprec/templates/centos/repository.erb +6 -0
- data/lib/deprec/templates/coraid/aoe-init +55 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/logrotate.erb +0 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d +14 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
- data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
- data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
- data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +22 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/logrotate.erb +0 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +109 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +120 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/postfix/main.cf.erb +41 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/postgresql/pg_hba.conf.erb +76 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/trac.ini.erb +106 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/xen/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xen-tools.conf.erb +220 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +69 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xen/xm.tmpl.erb +85 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/vmbuilder_plugins/gem.rb +90 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +207 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
### BEGIN INIT INFO
|
|
3
|
+
# Provides: xend
|
|
4
|
+
# Required-Start: $local_fs
|
|
5
|
+
# Required-Stop: $local_fs
|
|
6
|
+
# Default-Start: 2 3 4 5
|
|
7
|
+
# Default-Stop: S 0 1 6
|
|
8
|
+
# Short-Description: XEN control daemon
|
|
9
|
+
# Description: XEN control daemon
|
|
10
|
+
### END INIT INFO
|
|
11
|
+
|
|
12
|
+
if ! grep -q "control_d" /proc/xen/capabilities ; then
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Wait for Xend to be up
|
|
17
|
+
function await_daemons_up
|
|
18
|
+
{
|
|
19
|
+
i=1
|
|
20
|
+
rets=10
|
|
21
|
+
xend status
|
|
22
|
+
while [ $? -ne 0 -a $i -lt $rets ]; do
|
|
23
|
+
sleep 1
|
|
24
|
+
echo -n .
|
|
25
|
+
i=$(($i + 1))
|
|
26
|
+
xend status
|
|
27
|
+
done
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Rules for ip forwarding and NAT
|
|
31
|
+
# echo 1 >/proc/sys/net/ipv4/ip_forward
|
|
32
|
+
# echo 1 >/proc/sys/net/ipv4/conf/eth0/proxy_arp
|
|
33
|
+
# echo 1 >/proc/sys/net/ipv4/conf/eth1/proxy_arp
|
|
34
|
+
# IPTABLES=/sbin/iptables
|
|
35
|
+
# EXTIF=eth0
|
|
36
|
+
# INTIF=eth1
|
|
37
|
+
# $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
38
|
+
# $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
|
|
39
|
+
# $IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.1.0/24 -j MASQUERADE
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
case "$1" in
|
|
43
|
+
start)
|
|
44
|
+
xend start
|
|
45
|
+
await_daemons_up
|
|
46
|
+
;;
|
|
47
|
+
stop)
|
|
48
|
+
/etc/init.d/xendomains stop # make sure domains are shut down
|
|
49
|
+
xend stop
|
|
50
|
+
;;
|
|
51
|
+
status)
|
|
52
|
+
xend status
|
|
53
|
+
;;
|
|
54
|
+
reload)
|
|
55
|
+
xend reload
|
|
56
|
+
;;
|
|
57
|
+
restart|force-reload)
|
|
58
|
+
xend restart
|
|
59
|
+
await_daemons_up
|
|
60
|
+
;;
|
|
61
|
+
*)
|
|
62
|
+
# do not advertise unreasonable commands that there is no reason
|
|
63
|
+
# to use with this device
|
|
64
|
+
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}"
|
|
65
|
+
exit 1
|
|
66
|
+
esac
|
|
67
|
+
|
|
68
|
+
exit $?
|
|
69
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
## Path: System/xen
|
|
2
|
+
## Description: xen domain start/stop on boot
|
|
3
|
+
## Type: string
|
|
4
|
+
## Default:
|
|
5
|
+
#
|
|
6
|
+
# The xendomains script can send SysRq requests to domains on shutdown.
|
|
7
|
+
# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility
|
|
8
|
+
# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks
|
|
9
|
+
# of the domains ("s").
|
|
10
|
+
#
|
|
11
|
+
XENDOMAINS_SYSRQ=""
|
|
12
|
+
|
|
13
|
+
## Type: integer
|
|
14
|
+
## Default: 100000
|
|
15
|
+
#
|
|
16
|
+
# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait
|
|
17
|
+
# (in microseconds) after each SysRq, so the domain has a chance to react.
|
|
18
|
+
# If you want to a quick'n'dirty shutdown via SysRq, you may want to set
|
|
19
|
+
# it to a relatively high value (1200000).
|
|
20
|
+
#
|
|
21
|
+
XENDOMAINS_USLEEP=100000
|
|
22
|
+
|
|
23
|
+
## Type: integer
|
|
24
|
+
## Default: 5000000
|
|
25
|
+
#
|
|
26
|
+
# When creating a guest domain, it is sensible to allow a little time for it
|
|
27
|
+
# to get started before creating another domain or proceeding through the
|
|
28
|
+
# boot process. Without this, the booting guests will thrash the disk as they
|
|
29
|
+
# start up. This timeout (in microseconds) specifies the delay after guest
|
|
30
|
+
# domain creation.
|
|
31
|
+
#
|
|
32
|
+
XENDOMAINS_CREATE_USLEEP=5000000
|
|
33
|
+
|
|
34
|
+
## Type: string
|
|
35
|
+
## Default: ""
|
|
36
|
+
#
|
|
37
|
+
# Set this to a non-empty string if you want to migrate virtual machines
|
|
38
|
+
# on shutdown. The string will be passed to the xm migrate DOMID command
|
|
39
|
+
# as is: It should contain the target IP address of the physical machine
|
|
40
|
+
# to migrate to and optionally parameters like --live. Leave empty if
|
|
41
|
+
# you don't want to try virtual machine relocation on shutdown.
|
|
42
|
+
# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for
|
|
43
|
+
# that domain.
|
|
44
|
+
#
|
|
45
|
+
XENDOMAINS_MIGRATE=""
|
|
46
|
+
|
|
47
|
+
## Type: string
|
|
48
|
+
## Default: /var/lib/xen/save
|
|
49
|
+
#
|
|
50
|
+
# Directory to save running domains to when the system (dom0) is
|
|
51
|
+
# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE
|
|
52
|
+
# is set (see below). Leave empty to disable domain saving on shutdown
|
|
53
|
+
# (e.g. because you rather shut domains down).
|
|
54
|
+
# If domain saving does succeed, SHUTDOWN will not be executed.
|
|
55
|
+
#
|
|
56
|
+
# XENDOMAINS_SAVE=/var/lib/xen/save
|
|
57
|
+
|
|
58
|
+
## Type: string
|
|
59
|
+
## Default: "--halt --wait"
|
|
60
|
+
#
|
|
61
|
+
# If neither MIGRATE nor SAVE were enabled or if they failed, you can
|
|
62
|
+
# try to shut down a domain by sending it a shutdown request. To do this,
|
|
63
|
+
# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting
|
|
64
|
+
# for the domain to be really down. Leave empty to skip domain shutdown.
|
|
65
|
+
#
|
|
66
|
+
XENDOMAINS_SHUTDOWN="--halt --wait"
|
|
67
|
+
|
|
68
|
+
## Type: string
|
|
69
|
+
## Default: "--all --halt --wait"
|
|
70
|
+
#
|
|
71
|
+
# After we have gone over all virtual machines (resp. all automatically
|
|
72
|
+
# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq,
|
|
73
|
+
# migrated, saved and/or shutdown according to the settings above, we
|
|
74
|
+
# might want to shutdown the virtual machines that are still running
|
|
75
|
+
# for some reason or another. To do this, set this variable to
|
|
76
|
+
# "--all --halt --wait", it will be passed to xm shutdown.
|
|
77
|
+
# Leave it empty not to do anything special here.
|
|
78
|
+
# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY
|
|
79
|
+
# is set.)
|
|
80
|
+
#
|
|
81
|
+
XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait"
|
|
82
|
+
|
|
83
|
+
## Type: boolean
|
|
84
|
+
## Default: true
|
|
85
|
+
#
|
|
86
|
+
# This variable determines whether saved domains from XENDOMAINS_SAVE
|
|
87
|
+
# will be restored on system startup.
|
|
88
|
+
#
|
|
89
|
+
XENDOMAINS_RESTORE=true
|
|
90
|
+
|
|
91
|
+
## Type: string
|
|
92
|
+
## Default: /etc/xen/auto
|
|
93
|
+
#
|
|
94
|
+
# This variable sets the directory where domains configurations
|
|
95
|
+
# are stored that should be started on system startup automatically.
|
|
96
|
+
# Leave empty if you don't want to start domains automatically
|
|
97
|
+
# (or just don't place any xen domain config files in that dir).
|
|
98
|
+
# Note that the script tries to be clever if both RESTORE and AUTO are
|
|
99
|
+
# set: It will first restore saved domains and then only start domains
|
|
100
|
+
# in AUTO which are not running yet.
|
|
101
|
+
# Note that the name matching is somewhat fuzzy.
|
|
102
|
+
#
|
|
103
|
+
XENDOMAINS_AUTO=/etc/xen/auto
|
|
104
|
+
|
|
105
|
+
## Type: boolean
|
|
106
|
+
## Default: false
|
|
107
|
+
#
|
|
108
|
+
# If this variable is set to "true", only the domains started via config
|
|
109
|
+
# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ,
|
|
110
|
+
# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise
|
|
111
|
+
# all running domains will be.
|
|
112
|
+
# Note that the name matching is somewhat fuzzy.
|
|
113
|
+
#
|
|
114
|
+
XENDOMAINS_AUTO_ONLY=false
|
|
115
|
+
|
|
116
|
+
## Type: integer
|
|
117
|
+
## Default: 300
|
|
118
|
+
#
|
|
119
|
+
# On xendomains stop, a number of xm commands (xm migrate, save, shutdown,
|
|
120
|
+
# shutdown --all) may be executed. In the worst case, these commands may
|
|
121
|
+
# stall forever, which will prevent a successful shutdown of the machine.
|
|
122
|
+
# If this variable is non-zero, the script will set up a watchdog timer
|
|
123
|
+
# for every of these xm commands and time it out after the number of seconds
|
|
124
|
+
# specified by this variable.
|
|
125
|
+
# Note that SHUTDOWN_ALL will not be called if no virtual machines or only
|
|
126
|
+
# zombies are still running, so you don't need to enable this timeout just
|
|
127
|
+
# for the zombie case.
|
|
128
|
+
# The setting should be large enough to make sure that migrate/save/shutdown
|
|
129
|
+
# can succeed. If you do live migrations, keep in mind that live migration
|
|
130
|
+
# of a 1GB machine over Gigabit ethernet may actually take something like
|
|
131
|
+
# 100s (assuming that live migration uses 10% of the network # bandwidth).
|
|
132
|
+
# Depending on the virtual machine, a shutdown may also require a significant
|
|
133
|
+
# amount of time. So better setup this variable to a huge number and hope the
|
|
134
|
+
# watchdog never fires.
|
|
135
|
+
#
|
|
136
|
+
XENDOMAINS_STOP_MAXWAIT=300
|
|
137
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Configuration file for the Xen instance {$hostname}, created
|
|
3
|
+
# by xen-tools {$xen_tools_version} on { scalar localtime }.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Kernel + memory size
|
|
8
|
+
#
|
|
9
|
+
{ if ( $kernel )
|
|
10
|
+
{
|
|
11
|
+
$OUT.= "kernel = '$kernel'";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
{ if ( $initrd )
|
|
15
|
+
{
|
|
16
|
+
$OUT.= "ramdisk = '$initrd'";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
memory = '{$memory}'
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
# Disk device(s).
|
|
23
|
+
#
|
|
24
|
+
root = '/dev/{$device}1 ro'
|
|
25
|
+
{ if ( $noswap )
|
|
26
|
+
{
|
|
27
|
+
$OUT .= "disk = [ '$image_vbd,$device" . "1,w' ]";
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
{
|
|
31
|
+
$OUT .= "disk = [ '$image_vbd,$device" . "1,w', '$swap_vbd,$device" . "2,w' ]";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#
|
|
36
|
+
# Hostname
|
|
37
|
+
#
|
|
38
|
+
name = '{$hostname}'
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# Networking
|
|
42
|
+
#
|
|
43
|
+
{ if ( $dhcp )
|
|
44
|
+
{
|
|
45
|
+
$OUT .= "dhcp = 'dhcp'\n";
|
|
46
|
+
|
|
47
|
+
# Setup the mac address, if present.
|
|
48
|
+
my $m = '';
|
|
49
|
+
if ( $mac )
|
|
50
|
+
{
|
|
51
|
+
$m = "mac=$mac"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
$OUT .= "vif = [ '$m' ]";
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
{
|
|
58
|
+
#
|
|
59
|
+
# Setup the mac address, if present.
|
|
60
|
+
#
|
|
61
|
+
my $m = '';
|
|
62
|
+
if ( $mac )
|
|
63
|
+
{
|
|
64
|
+
$m = ",mac=$mac"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
$OUT .= "vif = [ 'ip=$ip1";
|
|
68
|
+
$OUT .= "$m' ]";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#
|
|
73
|
+
# Behaviour
|
|
74
|
+
#
|
|
75
|
+
on_poweroff = 'destroy'
|
|
76
|
+
on_reboot = 'restart'
|
|
77
|
+
on_crash = 'restart'
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
{ if ( $admins )
|
|
81
|
+
{
|
|
82
|
+
$OUT .= "xen_shell = '$admins'\n";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
extra = ' TERM=xterm xencons=tty console=tty1'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export CAP_TASKS=$( cap -T | grep '^cap' | cut -d' ' -f 2 )
|
|
2
|
+
_cap()
|
|
3
|
+
{
|
|
4
|
+
local cur tasks colonprefixes
|
|
5
|
+
COMPREPLY=()
|
|
6
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
7
|
+
|
|
8
|
+
tasks=$CAP_TASKS
|
|
9
|
+
# uncomment this for dynamic task lists
|
|
10
|
+
# tasks=$( cap -T | cut -d' ' -f 2 | grep deprec)
|
|
11
|
+
|
|
12
|
+
# Work-around bash_completion issue where bash interprets a colon
|
|
13
|
+
# as a separator.
|
|
14
|
+
# Work-around borrowed from the darcs work-around for the same
|
|
15
|
+
# issue.
|
|
16
|
+
colonprefixes=${cur%"${cur##*:}"}
|
|
17
|
+
COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
|
|
18
|
+
local i=${#COMPREPLY[*]}
|
|
19
|
+
while [ $((--i)) -ge 0 ]; do
|
|
20
|
+
COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"}
|
|
21
|
+
done
|
|
22
|
+
|
|
23
|
+
return 0
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
complete -F _cap cap
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# =all.rb: Load all the Capistrano Plugins in the directory.
|
|
2
|
+
#
|
|
3
|
+
# Require all other ruby files in the directory.
|
|
4
|
+
#
|
|
5
|
+
# ----
|
|
6
|
+
# Copyright (c) 2007 Neil Wilson, Aldur Systems Ltd
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the GNU Public License v2. No warranty is provided.
|
|
9
|
+
# ----
|
|
10
|
+
# = Usage
|
|
11
|
+
#
|
|
12
|
+
# require 'vmbuilder_plugins/all'
|
|
13
|
+
|
|
14
|
+
# Splitting and joining __FILE__ deals with the current directory case
|
|
15
|
+
# properly
|
|
16
|
+
Dir[File.join( File.dirname(__FILE__), '*.rb')].each do |plugin_name|
|
|
17
|
+
unless plugin_name == File.join(File.dirname(__FILE__), File.basename(__FILE__))
|
|
18
|
+
require plugin_name
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# =apt.rb: Debian 'apt' Installer library
|
|
2
|
+
# Capistrano plugin module to install and manage apt packages
|
|
3
|
+
#
|
|
4
|
+
# ----
|
|
5
|
+
# Copyright (c) 2007 Neil Wilson, Aldur Systems Ltd
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the GNU Public License v2. No warranty is provided.
|
|
8
|
+
|
|
9
|
+
require 'capistrano'
|
|
10
|
+
|
|
11
|
+
# = Purpose
|
|
12
|
+
# Apt is a Capistrano plugin module providing a set of methods
|
|
13
|
+
# that invoke the *apt* package manager (as used in Debian and Ubuntu)
|
|
14
|
+
#
|
|
15
|
+
# Installs within Capistrano as the plugin _apt_.
|
|
16
|
+
#
|
|
17
|
+
# =Usage
|
|
18
|
+
#
|
|
19
|
+
# require 'vmbuilder_plugins/apt'
|
|
20
|
+
#
|
|
21
|
+
# Prefix all calls to the library with <tt>apt.</tt>
|
|
22
|
+
#
|
|
23
|
+
module Apt
|
|
24
|
+
|
|
25
|
+
# Default apt-get command - reduces any interactivity to the minimum.
|
|
26
|
+
#APT_GET="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get"
|
|
27
|
+
APT_GET="yum -y"
|
|
28
|
+
|
|
29
|
+
# Run the apt install program across the package list in 'packages'.
|
|
30
|
+
# Select those packages referenced by <tt>:base</tt> and the +version+
|
|
31
|
+
# of the distribution you want to use.
|
|
32
|
+
def install(packages, version, options={})
|
|
33
|
+
#special_options="--allow-unauthenticated" if version != :stable
|
|
34
|
+
#sh -c "#{APT_GET} -qyu --force-yes #{special_options.to_s} install #{package_list(packages, version)}"
|
|
35
|
+
special_options = options[:repositories].collect { |repository| " --enablerepo=#{repository}"} if (options && options[:repositories].is_a?(Array))
|
|
36
|
+
send(run_method, %{
|
|
37
|
+
sh -c "#{APT_GET} #{special_options.to_s} install #{package_list(packages, version)}"
|
|
38
|
+
}, options)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Run an apt clean
|
|
42
|
+
def clean(options={})
|
|
43
|
+
send(run_method, %{sh -c "#{APT_GET} -qy clean"}, options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Run an apt autoclean
|
|
47
|
+
def autoclean(options={})
|
|
48
|
+
send(run_method, %{sh -c "#{APT_GET} -qy autoclean"}, options)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Run an apt distribution upgrade
|
|
52
|
+
def dist_upgrade(options={})
|
|
53
|
+
send(run_method, %{sh -c "#{APT_GET} -qy dist-upgrade"}, options)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Run an apt upgrade. Use dist_upgrade instead if you want to upgrade
|
|
57
|
+
# the critical base packages.
|
|
58
|
+
def upgrade(options={})
|
|
59
|
+
send(run_method, %{sh -c "#{APT_GET} -qy upgrade"}, options)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Run an apt update.
|
|
63
|
+
def update(options={})
|
|
64
|
+
send(run_method, %{sh -c "#{APT_GET} -qy update"}, options)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# RPM package install via alien
|
|
68
|
+
def rpm_install(packages, options={})
|
|
69
|
+
install({:base => %w(wget alien) }, :base)
|
|
70
|
+
send(run_method, "wget -Ncq #{packages.join(' ')}", options)
|
|
71
|
+
files=packages.collect { |package| File.basename(package) }
|
|
72
|
+
send(run_method, "alien -i #{files.join(' ')}", options)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Clear the source list and package cache
|
|
76
|
+
def clear_cache(options={})
|
|
77
|
+
clean
|
|
78
|
+
cmd="rm -f /var/cache/apt/*.bin /var/lib/apt/lists/*_* /var/lib/apt/lists/partial/*"
|
|
79
|
+
send(run_method, cmd, options)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
# Provides a string containing all the package names in the base
|
|
85
|
+
#list plus those in +version+.
|
|
86
|
+
def package_list(packages, version)
|
|
87
|
+
packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
Capistrano.plugin :apt, Apt
|
|
93
|
+
# vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby:
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# =emerge.rb: Gentoo 'emerge' Installer library
|
|
2
|
+
# Capistrano task library to install and manage portage packages
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2007 monki(Wesley Beary)
|
|
5
|
+
#
|
|
6
|
+
# inspiration: vmbuilder by Neil Wilson, Aldur Systems Ltd
|
|
7
|
+
#
|
|
8
|
+
# Licenced under the GNU Public License v2. No warranty is provided.
|
|
9
|
+
|
|
10
|
+
require 'capistrano'
|
|
11
|
+
|
|
12
|
+
# =Purpose
|
|
13
|
+
# emerge is a Capistrano plugin module providing a set of methods
|
|
14
|
+
# that invoke the portage package manage (as used in Gentoo)
|
|
15
|
+
#
|
|
16
|
+
# Installs within Capistrano as the plugin _emerge_.
|
|
17
|
+
#
|
|
18
|
+
# =Usage
|
|
19
|
+
#
|
|
20
|
+
# require 'marshall/plugins/emerge'
|
|
21
|
+
#
|
|
22
|
+
# Prefix all calls to the library with <tt>emerge.</tt>
|
|
23
|
+
#
|
|
24
|
+
module Emerge
|
|
25
|
+
# Default emerge command - reduce interactivity to the minimum
|
|
26
|
+
EMERGE="emerge -q"
|
|
27
|
+
|
|
28
|
+
# Emerge a new package or packages
|
|
29
|
+
def install(packages, options={})
|
|
30
|
+
cmd = <<-CMD
|
|
31
|
+
sh -c "#{EMERGE} #{packages.join(" ")}"
|
|
32
|
+
CMD
|
|
33
|
+
sudo(cmd, options)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Run clean old/unused packages
|
|
37
|
+
def clean(options={})
|
|
38
|
+
cmd = <<-CMD
|
|
39
|
+
sh -c "#{EMERGE} -clean"
|
|
40
|
+
CMD
|
|
41
|
+
sudo(cmd, options)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Upgrade installed package list
|
|
45
|
+
def upgrade(options={})
|
|
46
|
+
cmd = <<-CMD
|
|
47
|
+
sh -c "#{EMERGE} --sync"
|
|
48
|
+
CMD
|
|
49
|
+
sudo(cmd, options)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Update portage
|
|
53
|
+
def update_system(options={})
|
|
54
|
+
cmd = <<-CMD
|
|
55
|
+
sh -c "#{EMERGE} portage"
|
|
56
|
+
CMD
|
|
57
|
+
sudo(cmd, options)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Update all installed packages
|
|
61
|
+
def update(options={})
|
|
62
|
+
cmd = <<-CMD
|
|
63
|
+
sh -c "#{EMERGE} --update --deep --newuse world"
|
|
64
|
+
CMD
|
|
65
|
+
sudo(cmd, options)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Boot script manipulation command
|
|
69
|
+
def rc_update(packages, setting)
|
|
70
|
+
packages.each do |service|
|
|
71
|
+
sudo "rc_update add #{service} #{setting}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
Capistrano.plugin :emerge, Emerge
|