Chef

From wiki.kungfootek.net
Jump to: navigation, search

Compressed user, group, org documentation

List users:

$chef-server-ctl user-list

List the orgs on the server. Important later

$chef-server-ctl org-list [-a, --all-orgs], [-w, --with-uri]

Delete a user:

$chef-server-ctl user-delete USER_NAME

Add the user to the admins group.

$chef-server-ctl org-user-add ORG_NAME USER_NAME [--admin]

Remove a user from an org:

$chef-server-ctl org-use -remove ORG_NAME USER_NAME [--force]


Clone a git repo in a recipe

Found in the Chef Documentation

git "#{Chef::Config[:file_cache_path]}/app_name" do
  repository node[:app_name][:git_repository]
  revision node[:app_name][:git_revision]
  action :sync
end

The full syntax for all of the properties that are available to the git resource is:

git 'name' do
  additional_remotes         Hash
  checkout_branch            String
  depth                      Integer
  destination                String # defaults to 'name' if not specified
  enable_checkout            TrueClass, FalseClass
  enable_submodules          TrueClass, FalseClass
  environment                Hash
  group                      String, Integer
  notifies                   # see description
  provider                   Chef::Provider::Scm::Git
  reference                  String
  remote                     String
  repository                 String
  revision                   String
  ssh_wrapper                String
  subscribes                 # see description
  timeout                    Integer
  user                       String, Integer
  action                     Symbol # defaults to :sync if not specified
end

What this looks like in the wild:

git "/path/to/check/out/to" do
  repository "git://github.com/opscode/chef.git"
  reference "master"
  action :sync
end

Knife.rb

log_level :debug
log_location STDOUT
node_name 'node_name'
client_key "~/.chef/path-to-key.pem"
chef_server_url          'https://chef.server.tld'
#ssl_ca_path             '~/.chef/trusted_certs/'
validation_client_name   'chef-validator'
validation_key           '~/.chef/same-as-client-key.pem'
syntax_check_cache_path  '~/.chef/syntax_check_cache'
cookbook_path [ 'best-to-declare-this-explicitly/cookbooks']
knife[:editor]="/usr/bin/vim"
ssl_verify_mode :verify_none