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
70
71
72
73
74
75
76
|
# File 'lib/capistrano/ext/capstrap/chef.rb', line 4
def self.load_into(configuration)
configuration.load do
namespace :chef do
namespace :install do
desc "Installs chef gem"
task :lib do
unless chef_installed?
cmd = [
%{use #{ruby}},
%{gem install chef --no-rdoc --no-ri}
]
rvm_run cmd.join(" && ")
end
end
desc "Installs chef cookbook git repository"
task :cookbooks do
unless cookbooks_repo_installed?
cmd = [
%{use #{ruby}},
%{git clone #{cookbooks_repo} #{cookbooks_path}},
%{cd #{cookbooks_path}},
update_cmd
]
rvm_run cmd.join(" && ")
end
end
desc "Installs chef configuration git repository"
task :config do
unless config_repo_installed?
cmd = [
%{use #{ruby}},
%{git clone #{config_repo} #{config_path}},
%{cd #{config_path}},
update_cmd
]
rvm_run cmd.join(" && ")
end
end
end
namespace :execute do
desc "Executes chef solo configuration"
task :solo do
cmd = [
%{use #{ruby}},
%{chef-solo}
]
rvm_run cmd.join(" && ")
end
desc "Updates and executes chef solo configuration"
task :update do
cmd = [
%{use #{ruby}},
%{cd #{cookbooks_path}},
%{git pull},
update_cmd,
%{cd #{config_path}},
update_cmd,
%{cd},
%{chef-solo}
]
rvm_run cmd.join(" && ")
end
end
end
end
end
|