This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_mac_address | |
"00:16:3E:%X%X:%X%X:%X%X" % Array.new(6) { rand(16) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#####Libraries default.rb | |
module mac_address | |
def generate_mac_address | |
#"00:16:3E:%X%X:%X%X:%X%X" % Array.new(6) { rand(16) } | |
end | |
extend self | |
end | |
#####Attributes defualt.rb | |
default.xenserver[:macaddress] = "<% @mac_address %>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@chef attributes]# knife node edit CentOSBase.millicorp.com | |
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:333:in `edit_data': Please set EDITOR environment variable (RuntimeError) | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:409:in `edit_object' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife/node_edit.rb:38:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:127:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/application/knife.rb:118:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/knife:25 | |
from /usr/bin/knife:19:in `load' | |
from /usr/bin/knife:19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####Try #1 | |
search(:node, 'run_list:"recipe[xenserver::default]"') do |matching_node| | |
execute "chef-client" do | |
action :run | |
end | |
end | |
###ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@chef cookbooks]# knife node run_list add chef.millicorp.com recipe[vm-creation::default] | |
{ | |
"run_list": [ | |
"recipe[vm-creation::default]" | |
] | |
} | |
[root@chef cookbooks]# knife search node recipe:vm-creation | |
{ | |
"total": 0, | |
"start": 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search(:node, 'run_list:recipe\[xenserver\:\:default\]') do |matching_node| | |
execute "xe vm-copy vm=CentOSBase new-name-label=#{node[:VMName]}" do | |
action :run | |
end | |
execute "xe vm-start vm=#{node[:VMName]}" do | |
action :run | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knife ssh 'run_list:recipe\[xenserver\:\:default\]' 'xe vm-copy vm=CentOSBase new-name-label=Test' | |
/usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.23/lib/net/ssh/transport/session.rb:65:in `initialize': Connection timed out - connect(2) (Errno::ETIMEDOUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knife ssh 'run_list:recipe[xenserver::default]' 'xe vm-copy vm=CentOSBase new-name-label=Test' | |
WARN: HTTP Request Returned 500 Internal Server Error: 400 "orgapachelucenequeryParserParseException_Cannot_parse_run_listrecipexenserverdefault_Encountered_____at_line_1_column_34_Was_expecting_one_of_____TO______RANGEIN_QUOTED______RANGEIN_GOOP______" | |
/usr/lib/ruby/1.8/net/http.rb:2097:in `error!': 500 "Internal Server Error" (Net::HTTPFatalError) | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:229:in `api_request' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:280:in `retriable_rest_request' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:210:in `api_request' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/rest.rb:110:in `get_rest' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/search/query.rb:37:in `search' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife/ssh.rb:85:in `configure_session' | |
from /usr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@chef .chef]# knife xen server list | |
/usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/connection.rb:34:in `request': undefined method `first' for #<Hash:0x2aea2d56f3c8> (NoMethodError) | |
from /usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/requests/get_vms.rb:9:in `get_vms' | |
from /usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/models/servers.rb:18:in `all' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife/xen_server_list.rb:67:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:127:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/application/knife.rb:118:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/knife:25 | |
from /usr/bin/knife:19:in `load' | |
from /usr/bin/knife:19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@chef tmp]# knife xen server list | |
/usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/connection.rb:34:in `request': undefined method `first' for #<Hash:0x2b9617b89d30> (NoMethodError) | |
from /usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/requests/get_vms.rb:9:in `get_vms' | |
from /usr/lib/ruby/gems/1.8/gems/fog-0.3.17/lib/fog/xenserver/models/servers.rb:18:in `all' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife/xen_server_list.rb:67:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:127:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef/application/knife.rb:118:in `run' | |
from /usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/knife:25 | |
from /usr/bin/knife:19:in `load' | |
from /usr/bin/knife:19 |
OlderNewer