-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.rb
More file actions
54 lines (46 loc) · 1.53 KB
/
install.rb
File metadata and controls
54 lines (46 loc) · 1.53 KB
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
require 'yaml'
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, deployer_user: NODE_CONFIG['deployer_user']
requires :swap, deployer_user: NODE_CONFIG['deployer_user'], swap_size: NODE_CONFIG['swap_size'] unless ENV['NO_SWAP']
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'] if NODE_CONFIG['root_password']
set :ssh_options, forward_agent: true
end
end
else
policy :provision, roles: :provision do
NODE_CONFIG['packages'].each do |package, options|
options ||= {}
requires package, options.symbolize_keys
end
end
deployment do
delivery :capistrano do
recipes 'Capfile'
role :provision, NODE_CONFIG['ip']
set :user, NODE_CONFIG['deployer_user']
set :pty, true
set :ssh_options, forward_agent: true
end
# source based package installer defaults
source do
prefix '/usr/local'
archives '/usr/local/sources'
builds '/usr/local/build'
end
end
end
end