Skip to content

Instantly share code, notes, and snippets.

@ssudharsan
Last active June 29, 2017 20:23
Show Gist options
  • Save ssudharsan/e5941195f79074e46f3c to your computer and use it in GitHub Desktop.
Save ssudharsan/e5941195f79074e46f3c to your computer and use it in GitHub Desktop.
Running chef manually in a opsworks instance
# put the cookbook path in solo.rb file.
echo 'cookbook_path ["/opt/aws/opsworks/current/site-cookbooks"]' > solo.rb
# create json file incase if you want use the attributes from opsworks.
opsworks-agent-cli get_json > attributes.json
#run chef-solo
/opt/aws/opsworks/current/bin/chef-solo -c solo.rb -o cookbook_name::default -j attributes.json
@jamesoflol
Copy link

This is excellent. Thank you! Simple, elegant, and works. This frees up so much hassle doing micro code tests.

One note - depending on the use case, people may want to use 'merged-cookbooks' instead of 'site-cookbooks' - which includes the stock opsworks cookbooks merged in with your own?

@nijotz
Copy link

nijotz commented Apr 5, 2017

Thank you so much. Was digging through AWS docs forever until I found this. So much easier to iterate now.

@qpfiffer
Copy link

qpfiffer commented Apr 5, 2017

📦

@nijotz
Copy link

nijotz commented Apr 5, 2017

🌮 🥇 🍔

@noboomu
Copy link

noboomu commented Jun 29, 2017

If you use berkshelf use this instead:
echo 'cookbook_path ["/opt/aws/opsworks/current/berkshelf-cookbooks"]' > solo.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment