Skip to content

Instantly share code, notes, and snippets.

@mikehale
Created May 9, 2009 02:37
Show Gist options
  • Save mikehale/109099 to your computer and use it in GitHub Desktop.
Save mikehale/109099 to your computer and use it in GitHub Desktop.
dna.rb generates json, gets handed to chef-solo, makes box happy
require 'rubygems'
require 'json'
my_ssh_keys = [
'ssh-rsa blah1',
'ssh-rsa blah1'
]
other_guy_ssh_keys = [
'ssh-rsa blah1'
]
dna = {
:fully_qualified_domain_name => "example.com",
:mysql => { :skip_networking => true },
:apache => { :listen_ports => ["80", "443"] },
:passenger => {:config => {
"PassengerUseGlobalQueue" => "on",
"PassengerEnabled" => "off"
}},
:webapps => [
{
:name => "exampleapp",
:server_name => "staging.example.com",
:port => 80,
:authorized_keys => my_ssh_keys + other_guy_ssh_keys,
:env => "staging"
},
{
:name => "homepage",
:server_name => "example.com",
:server_aliases => ["www.example.com"],
:authorized_keys => my_ssh_keys + other_guy_ssh_keys
}
],
:gems => [
"rake",
{:name => "mysql", :version => "2.7"},
{:name => "rails", :version => "2.3.2"}
],
:recipes => [
"base",
"hostname",
"openssh",
"git",
"mysql::server",
"apache2", "apache2::mod_rails", "apache2::mod_ssl",
"passenger",
"rsync",
"postfix",
"gems",
"webapps"
]
}
open(File.dirname(__FILE__) + "/dna.json", "w").write(dna.to_json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment