Module: Capichef
- Defined in:
- lib/capichef.rb,
lib/capichef/node.rb,
lib/capichef/role.rb,
lib/capichef/version.rb,
lib/capichef/environment.rb
Defined Under Namespace
Modules: Environment, Node, Role
Constant Summary
collapse
- VERSION =
'0.0.2'.freeze
Class Method Summary
collapse
Class Method Details
9
10
11
12
13
|
# File 'lib/capichef.rb', line 9
def self.configure
knife = Chef::Knife.new
Chef::Config[:verbosity] = 1
knife.configure_chef
end
|
.load_into(configuration) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/capichef.rb', line 28
def self.load_into(configuration)
self.configure
configuration.load do
def _cset(name, *args, &block)
unless exists?(name)
set(name, *args, &block)
end
end
namespace :chef do
desc "Run chef on all server defined."
task :provision do
run "#{try_sudo} chef-client"
end
end
end
Capichef::Environment.load_into(configuration)
Capichef::Role.load_into(configuration)
end
|
.replace_attribute_placeholder(string, node) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/capichef.rb', line 15
def self.replace_attribute_placeholder(string, node)
string.gsub %r{\$CAPICHEF_NODE:(.+?)\$} do |full_match|
attribute = node.attributes
$1.split('.').each do |key|
if attribute.attribute?(key)
attribute = attribute[key]
end
end
attribute.to_s
end
end
|