Skip to content

Instantly share code, notes, and snippets.

View behemphi's full-sized avatar

Boyd Hemphill behemphi

  • Grand Junction, CO
View GitHub Profile
@behemphi
behemphi / gist:4151127
Created November 26, 2012 22:38
repeat output knife-rackspace 0.6.3 -VV
DEBUG: Using configuration from /opt/myuser/.chef/knife.rb
DEBUG: version v2 (config)
DEBUG: version v2 (cli)
DEBUG: rackspace_api_key <secret>
DEBUG: rackspace_username
DEBUG: rackspace_api_username myuser
DEBUG: rackspace_auth_url (config)
DEBUG: rackspace_auth_url auth.api.rackspacecloud.com (cli)
DEBUG: rackspace_endpoint https://dfw.servers.api.rackspacecloud.com/v2 (config)
DEBUG: rackspace_endpoint https://dfw.servers.api.rackspacecloud.com/v2 (cli)
Resource Declaration:
---------------------
# In /var/cache/chef/cookbooks/fm_one_time/recipes/pre_2_4_100.rb
24: bash "Double Tap on microwave" do
25: user "root"
26: cwd "/tmp"
27: code <<-EOH
28: pkill -U microwave
29: EOH
@behemphi
behemphi / gist:4772880
Created February 12, 2013 19:59
knife-rackspace error
Instance ID: 2a0b5efd-6b3b-49ac-970b-73bca5be7ba5
Name: merryutil
Flavor: 512MB Standard Instance
Image: Ubuntu 10.04 LTS (Lucid Lynx)
Waiting server.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-rackspace-0.6.3/lib/chef/knife/rackspace_base.rb:139:in `rescue in public_dns_name': undefined method `gsub' for nil:NilClass (NoMethodError)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-rackspace-0.6.3/lib/chef/knife/rackspace_base.rb:136:in `public_dns_name'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-rackspa
Note that the recipe base is in the runlist first.
Note that after loading the cookbooks (where base should produce many lines of code for creating ssh users and such) it skips
not to the first command of the the kitchen::knife recipe, but third.
[2013-02-12T21:51:18+00:00] INFO: *** Chef 10.16.2 ***
[2013-02-12T21:51:22+00:00] INFO: Run List is [recipe[base], recipe[kitchen]]
[2013-02-12T21:51:22+00:00] INFO: Run List expands to [base, kitchen]
[2013-02-12T21:51:22+00:00] INFO: Starting Chef Run for openkitchen
[2013-02-12T21:51:22+00:00] INFO: Running start handlers
@behemphi
behemphi / gist:5001817
Created February 21, 2013 03:31
basic nginx
1 user nginx;
2 worker_processes 1;
3
4 events {
5 worker_connections 1024;
6 }
7
8 http {
9 include /etc/nginx/mime.types;
10 default_type application/octet-stream;
@behemphi
behemphi / gist:5249555
Created March 26, 2013 21:39
A question of execution order:
In the attributes file, the value is set:
default['feedmagnet']['db']['host_ip'] = 'localhost'
```ruby
if node.chef_environment.include?('large')
nodes = search(:node, "name:#{node.feedmagnet.instance_name}*") # Three nodes are found (merry-util, merry-console, merry-db)
log "# nodes #{nodes.count()}" # 3
@behemphi
behemphi / gist:5337841
Created April 8, 2013 15:47
chef use of rescue
begin
server_block_data =
data_bag_item('customer_server_blocks', node.feedmagnet.instance_name)
rescue
log "no data bag for customer server blocks found"
end
{
"chef_type": "environment",
"cookbook_versions": {
"apt": "= 1.5.0",
"base": "= 2.4.131",
"chef-client": "= 0.99.3",
"chef_handler": "= 1.0.8",
"erlang": "= 1.1.0",
"fm_console": "= 2.4.131",
"fm_deployment": "= 2.4.131",
{
"chef_type": "role",
"default_attributes": {
"ntp": {
"servers": [
"10.181.13.214"
]
}
},
"description": "The db-host is used when a dedicated database should be available.",
case (Integer((node[:memory][:total]).sub('kB','')) / 1024)
when 0..900
config_bag = 'webserver_512mb'
when 901..1500
config_bag = 'webserver_1024mb'
when 1501..2500
config_bag = 'webserver_2048mb'
else
config_bag = 'webserver_2048mb'
log("no config file exists for a server of this size.") { level :warn }