Skip to content

Instantly share code, notes, and snippets.

@paul1994
Created August 8, 2019 17:21
Show Gist options
  • Save paul1994/1ac817c62168707a3065d77629b83026 to your computer and use it in GitHub Desktop.
Save paul1994/1ac817c62168707a3065d77629b83026 to your computer and use it in GitHub Desktop.
cheat sheet
## Cheat sheet
# Chef Commands
chef generate cookbook cookbooks/<cookbook>
chef generate recipe cookbooks/<cookbook> <recipe>
chef generate template cookbooks/<cookbook> <template>
chef generate attribute cookbooks/<cookbook> <attribute>
# Chef Client
chef-client --local-mode --runlist "recipe[<cookbook>::<recipe>"
# policyfiles
chef generate <policyfile>
chef install <policyfile.rb>
chef push <env/group> <policy name>
chef show-policy
## Syntax items
To include recipes in a recipe:
include_recipe '<cookbook>::<recipe>'
# Repo for chef server
https://github.com/chef-training/foundations-cookbook-repo
# Bootstraping
knife bootstrap -o winrm <publicip> -U <username> -P <password> -N <node name>
## Knife commands
knife node list
knife node show <node_name>
knife node poilcy set <node name> <env/group> <policy_name>
#windows knife command
knife winrm <public_ip> -m -x <username> -P <password> "<command you want to run>"
#linux knife command
knife ssh <public_ip> -m -x <username> -P <password> "<command you want to run>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment