forked from Railsreactor/provision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.rb
48 lines (41 loc) · 1.18 KB
/
install.rb
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
Dir[File.join(File.dirname(__FILE__), '/lib/*.rb')].each { |f| require f }
Dir[File.join(File.dirname(__FILE__), '/packages/*.rb')].each { |f| require f }
# Configuration
nodes_path = File.join(File.dirname(__FILE__), 'nodes.yml')
NODES = YAML::load(File.open(nodes_path))
NODE_CONFIG = NODES[ENV['NODE']]
if NODE_CONFIG['enabled']
if ENV['STAGE'] == 'setup'
policy :setup, :roles => :setup do
requires :setup_system
end
deployment do
delivery :capistrano do
recipes 'Capfile'
role :setup, NODE_CONFIG['ip']
set :user, NODE_CONFIG['root_user']
set :password, NODE_CONFIG['root_password']
end
end
else
policy :provision, :roles => :provision do
NODE_CONFIG['packages'].each do |package|
requires package
end
end
deployment do
delivery :capistrano do
recipes 'Capfile'
role :provision, NODE_CONFIG['ip']
set :user, NODE_CONFIG['deployer_user']
set :pty, true
end
# source based package installer defaults
source do
prefix '/usr/local'
archives '/usr/local/sources'
builds '/usr/local/build'
end
end
end
end