Skip to content

Instantly share code, notes, and snippets.

@philwo
Created April 16, 2012 05:16
Show Gist options
  • Save philwo/2396442 to your computer and use it in GitHub Desktop.
Save philwo/2396442 to your computer and use it in GitHub Desktop.
Chef attributes, roles and environment
### cookbooks/nova/attributes/default.rb:
# you should override controller_ip for a multi-node setup
default['nova']['controller_ip'] = "127.0.0.1"
default['nova']['db_ipaddress'] = node['mysql']['bind_address']
default['nova']['rabbitmq_ipaddress'] = node['nova']['controller_ip']
default['nova_api']['ipaddress'] = node['nova']['controller_ip']
[philwo@philwo ca-openstack]$ knife environment show stackcluster1 -fj
{
"name": "stackcluster1",
"description": "Playground cluster #1 (stacktest1, stacktest2, stacktest3)",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
},
"override_attributes": {
"nova": {
"controller_ip": "10.5.28.22"
},
"mysql": {
"server_root_password": "ahFvF91JEsz8",
"bind_address": "10.5.28.22"
}
}
}
[philwo@philwo ca-openstack]$ knife role show openstack_compute -fj
{
"name": "openstack_compute",
"description": "OpenStack compute node",
"json_class": "Chef::Role",
"default_attributes": {
"nova": {
"controller_ip": "10.5.28.22"
},
"mysql": {
"server_root_password": "ahFvF91JEsz8",
"bind_address": "10.5.28.22"
}
},
"override_attributes": {
"nova": {
"controller_ip": "10.5.28.22"
},
"mysql": {
"server_root_password": "ahFvF91JEsz8",
"bind_address": "10.5.28.22"
}
},
"chef_type": "role",
"run_list": [
"recipe[apt]",
"role[ntp_client]",
"recipe[mysql::client]",
"recipe[nova::common]",
"recipe[nova::compute]"
],
"env_run_lists": {
}
}
[philwo@philwo ca-openstack]$ knife node show stacktest2 -fj
{
"name": "stacktest2",
"chef_environment": "stackcluster1",
"run_list": [
"role[openstack_compute]"
],
"normal": {
"postgresql": {
"dir": "/etc/postgresql/9.1/main"
},
"include_attributes": "nova",
"mysql": {
"old_passwords": 0,
"socket": "/var/run/mysqld/mysqld.sock",
"pid_file": "/var/run/mysqld/mysqld.pid",
"conf_dir": "/etc/mysql",
"grants_path": "/etc/mysql/grants.sql"
},
"tags": [
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment