{"id":16444935,"url":"https://github.com/jaymon/chef-cookbooks","last_synced_at":"2026-01-31T23:41:22.219Z","repository":{"id":66175161,"uuid":"131218028","full_name":"Jaymon/chef-cookbooks","owner":"Jaymon","description":"Various Chef cookbooks","archived":false,"fork":false,"pushed_at":"2024-08-28T16:30:37.000Z","size":529,"stargazers_count":2,"open_issues_count":34,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T17:04:12.889Z","etag":null,"topics":["chef","chef-cookbook","chef-solo","provisioning","provisioning-scripts","server-provision"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaymon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-26T22:42:33.000Z","updated_at":"2024-08-28T16:30:40.000Z","dependencies_parsed_at":"2024-08-03T22:27:11.083Z","dependency_job_id":"439ae7ea-1307-42e4-8fdb-72ffad6f03cf","html_url":"https://github.com/Jaymon/chef-cookbooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jaymon/chef-cookbooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fchef-cookbooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fchef-cookbooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fchef-cookbooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fchef-cookbooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaymon","download_url":"https://codeload.github.com/Jaymon/chef-cookbooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaymon%2Fchef-cookbooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28960660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T23:03:11.038Z","status":"ssl_error","status_checked_at":"2026-01-31T22:56:44.691Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbook","chef-solo","provisioning","provisioning-scripts","server-provision"],"created_at":"2024-10-11T09:42:41.125Z","updated_at":"2026-01-31T23:41:22.199Z","avatar_url":"https://github.com/Jaymon.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cookbooks\n\nWriting a new cookbook? [Chef resources](https://docs.chef.io/resource.html)\n\nThe common cookbooks I use to configure boxes. This repo is really designed to be a sub-repo in other repos.\n\nEvery cookbook should have a `README.md` file that should tell you how to configure it and what it does (if the name isn't self explanatory enough).\n\n\n## Tips and Common pitfalls when writing cookbooks\n\nthese are things I always forget and have to remember time and time again.\n\n\n### Chef configuration in Vagrant\n\n* [Vagrant chef configuration options](https://www.vagrantup.com/docs/provisioning/chef_common.html)\n* [Other Vagrant chef configuration](https://www.vagrantup.com/docs/provisioning/chef_solo.html)\n\n\n### Upstart and Vagrant shared folders\n\nIf your Upstart script relies on system startup to start your scripts, something like:\n\n    start on (local-filesystems and runlevel [2345])\n\nand your scripts depend on something in one of your repos that Vagrant mounts as a shared folder, then chances are your scripts aren't going to actually start when the Vagrant box is brought up.\n\nThere are two solutions, one is to just move the files to a new place, for example, the `spiped` cookbook will move the keys from our repo to `/etc/spiped` on the box so they will be there on machine start.\n\nYou can also have your upstart script also listen on `vagrant-mounted` events, this is what the `uwsgi` cookbook does.\n\n    start on ((local-filesystems and runlevel [2345]) or vagrant-mounted)\n\nI evidently prefer the first method since most of the cookbooks ultimately go with that, I did it the other way with `uwsgi` because I forgot about this (which is why it is now in this readme :) )\n\n\n### /var/run is not permanent storage\n\nI don't know how many times I'm going to need to learn this, but on startup, this directory is cleared, so you can't just have your cookbook create a directory in `/var/run` and set its permissions, you need to actually do it in your upstart script\n\n    pre-start script\n        # mode is world executable because evidently you need to execute something to write\n        # directory is completely opened because each command could be run under a different user\n        mkdir -p -m0777 \u003c%= @run_dir %\u003e\n        #chown \u003c%= @username %\u003e:\u003c%= @group %\u003e \u003c%= @run_dir %\u003e\n    end script\n\n\n### Running Chef on Vagrant Manually\n\n    $ cd /tmp/vagrant-chef\n    $ chef-client --config solo.rb -j dna.json --local-mode\n\n\n### Printing out values in recipes\n\n```ruby\nrequire \"pp\"\npp \"=======================================================================\"\npp node[\"\u003cRECIPE_NAME\u003e\"]\npp \"=======================================================================\"\n```\n\n\n### Changes in Vagrant chef.json not propogating to chef run\n\nSometimes, when I'm testing cookbooks and so I'm running `vagrant provision` a lot \nthe changes I make to the `chef.json` don't seem to propogate, this seems to be because\nof a cache file, something like:\n\n```\n/tmp/vagrant-chef/f8484c02f82283b9072da693e6402db9/nodes/vagrant-fb4087a6.json\n```\n\nThat will have the original values of the `/tmp/vagrant-chef/dna.json` file.\n\nDeleting the `vagrant-fb4087a6.json` file seems to fix it.\n\n\n#### Search\n\n* vagrantfile removing key in chef.json doesn't get rid of value because of node\n\n\n### Chef OS Environment\n\n```ruby\nif platform?('ubuntu') \u0026\u0026 node['platform_version'].to_f \u003c= 14.04\n```\n\n\n### Service stopping and starting\n\nWhen wanting to restart a service on change, it's usually better to do this:\n\n```ruby\nnotifies :stop, \"service[\u003cNAME\u003e]\", :delayed\nnotifies :start, \"service[\u003cNAME\u003e]\", :delayed\n```\n\nOver...\n\n```ruby\nnotifies :restart, \"service[\u003cNAME\u003e]\", :delayed\n```\n\nThe reason why is sometimes not everything is in place or the service isn't currently running when you want to restart, and so it will fail, but the stop then start method seems to mitigate this and reliably works with changes and stuff.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fchef-cookbooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaymon%2Fchef-cookbooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymon%2Fchef-cookbooks/lists"}