Created
July 29, 2012 23:12
-
-
Save Gurpartap/3202464 to your computer and use it in GitHub Desktop.
chef-client cookbook getting started
This file contains hidden or 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
(cat <<'EOP' | |
name "base" | |
description "Base role applied to all nodes" | |
override_attributes( | |
"chef_client" => { | |
"server_url" => "https://api.opscode.com/organizations/ORGNAME", | |
"validation_client_name" => "ORGNAME-validator" | |
} | |
) | |
run_list( | |
"recipe[chef-client::config]", | |
"recipe[chef-client::service]", | |
"recipe[chef-client::delete_validation]" | |
) | |
EOP | |
) | sudo tee /var/chef-solo/roles/base.rb |
This file contains hidden or 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
$ (cat <<'EOP' | |
{ | |
"run_list": ["role[base]"] | |
} | |
EOP | |
) | sudo tee /tmp/chef-solo.json |
This file contains hidden or 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
$ cat /etc/chef/client.rb | |
log_level :info | |
log_location STDOUT | |
chef_server_url "https://api.opscode.com/organizations/ORGNAME" | |
validation_client_name "ORGNAME-validator" | |
node_name "sub.example.com" | |
file_backup_path "/var/lib/chef" | |
file_cache_path "/var/cache/chef" | |
pid_file "/var/run/chef/client.pid" |
This file contains hidden or 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
$ curl -L http://www.opscode.com/chef/install.sh | sudo bash |
This file contains hidden or 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
$ sudo chef-solo --config /etc/chef/solo.rb --node-name sub.example.com |
This file contains hidden or 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
$ (cat <<'EOP' | |
file_cache_path "/var/chef-solo" | |
cookbook_path "/var/chef-solo/cookbooks" | |
role_path "/var/chef-solo/roles" | |
json_attribs "/tmp/chef-solo.json" | |
recipe_url "http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz" | |
# when COOK-1506 is fixed, chef_server_url can be omitted. | |
# see http://tickets.opscode.com/browse/COOK-1506 | |
chef_server_url "https://api.opscode.com/organizations/ORGNAME" | |
EOP | |
) | sudo tee /etc/chef/solo.rb |
This file contains hidden or 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
$ sudo mkdir -p /etc/chef/ | |
$ (cat <<'EOP' | |
# redacted | |
EOP | |
) | sudo tee /etc/chef/validation.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment