Skip to content

Instantly share code, notes, and snippets.

@maxivak
Created October 20, 2016 08:12
Show Gist options
  • Save maxivak/4e3cfe945d84df2c4f28391b1ffc065f to your computer and use it in GitHub Desktop.
Save maxivak/4e3cfe945d84df2c4f28391b1ffc065f to your computer and use it in GitHub Desktop.
Run Chef recipes on test kitchen

Run Chef recipes on test kitchen

  • Installing Chef Client with Test Kitchen

  • Node is a test kitchen

  • Create kitchen

  • Use the kitchen login command to connect to your node and install chef-client on the node

kitchen login default-ubuntu1404

curl -Lk https://www.getchef.com/chef/install.sh | sudo bash
  • check Chef Client is installed on the node
chef-client --version
  • Setup kitchen.

run from your workstation:

kitchen setup default-ubuntu1404

Run from inside the node

  • create simple script on the node
# login to kitchen
kitchen login ..

# hello.rb
log "nothing special"

  • run script on the node
# login to kitchen
kitchen login ..

# from node
chef-client -z hello.rb

Notes about test kitchen and chef-solo:

  • The kitchen setup command is used to run a provisioner.
  • By default, Test Kitchen is configured to use the ChefSolo provisioner, which installs Chef Client without configuring the tools to use a Chef Server.
  • kitchen setup will automatically install chef-client for you

Run using kitchen converge

  • kitchen converge performs a Chef run on your test node from your host.
kitchen converge default-ubuntu1404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment