{"id":17154696,"url":"https://github.com/jzohrab/learn_chef_vagrant","last_synced_at":"2026-02-01T21:05:09.684Z","repository":{"id":93091988,"uuid":"49903168","full_name":"jzohrab/learn_chef_vagrant","owner":"jzohrab","description":"An Ubuntu Vagrant box to accompany the tutorials at https://learn.chef.io","archived":false,"fork":false,"pushed_at":"2016-01-22T16:53:28.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T06:06:53.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jzohrab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-18T20:28:25.000Z","updated_at":"2016-01-18T20:28:25.000Z","dependencies_parsed_at":"2023-04-18T20:05:26.070Z","dependency_job_id":null,"html_url":"https://github.com/jzohrab/learn_chef_vagrant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jzohrab/learn_chef_vagrant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzohrab%2Flearn_chef_vagrant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzohrab%2Flearn_chef_vagrant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzohrab%2Flearn_chef_vagrant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzohrab%2Flearn_chef_vagrant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jzohrab","download_url":"https://codeload.github.com/jzohrab/learn_chef_vagrant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jzohrab%2Flearn_chef_vagrant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28990735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T20:57:35.821Z","status":"ssl_error","status_checked_at":"2026-02-01T20:57:29.580Z","response_time":56,"last_error":"SSL_read: 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":[],"created_at":"2024-10-14T21:49:47.763Z","updated_at":"2026-02-01T21:05:09.662Z","avatar_url":"https://github.com/jzohrab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chef DK Vagrant box\n\nThis provides an Ubuntu development environment and separate node\nfor the tutorials at [learnchef](https://learn.chef.io).\n\nThe introductory [tutorial](https://learn.chef.io/)\nrecommends setting up a disposable VM and installing ChefDK in it, as\nthe tutorial modifies the host machine.  By using Vagrant, you can\nwork with your favorite editor on your own machine, and then ssh into\nthe guest machine and apply recipes.\n\n## Prerequisites\n\n* [Vagrant](http://vagrantup.com/downloads)\n* [VirtualBox](https://www.virtualbox.org/)\n\n## Usage\n\n* Create a directory, and copy the Vagrantfile to your local machine.\n  Optionally, clone this repository.\n* Run `vagrant up workstation` to set up the ubuntu VM with the Chef\n  DK.  This also creates a `chef-repo` synced file in the local folder\n  (ignored by git).\n* Run `vagrant up node` to create a new node that Chef will manage.\n\n### Creating cookbooks\n\nGenerate a cookbook in the VM:\n\n    vagrant ssh workstation\n    cd ~/chef-repo\n    chef generate cookbook learn_chef_apache2\n\nThrough Vagrant syncing, this file is then available for editing\nlocally machine (under `./chef-repo/cookbooks/learn_chef_apache2`).\nChanges are synced to the VM.\n\nNote: the `chef-repo/` directory is ignored in Git.\n\n### Applying recipes or cookbooks to the development environment\n\nPertains to tutorials:\n\n* https://learn.chef.io/learn-the-basics/ubuntu/configure-a-package-and-service/\n* https://learn.chef.io/learn-the-basics/ubuntu/make-your-recipe-more-manageable/\n\nRunning recipes or cookbooks will change the hosted VM, and so the\ncommands will need to be run as root.  Either use `sudo` or `su` with\npassword vagrant, e.g.:\n\n    $ vagrant ssh workstation\n    ...\n    vagrant@server:~$ su\n    Password:   # the password is vagrant\n    root@server:/home/vagrant# cd chef-repo/\n    root@server:/home/vagrant/chef-repo# chef-apply hello.rb\n    Recipe: (chef-apply cookbook)::(chef-apply recipe)\n    ...\n\nThe host machine's port 8080 is forwarded to the `workstation` guest\nVM's port 80.  After running the `webserver.rb` recipe, you will be\nable to see the site at http://localhost:8080.\n\n### Using Chef to manage the `node` VM\n\nPertains to tutorial: https://learn.chef.io/manage-a-node/ubuntu/bootstrap-your-node/\n\nThe `node` VM has private IP address 192.168.1.10, with the default\nvagrant user.  You can provision this node as follows:\n\n    $ vagrant ssh workstation\n    vagrant@workstation:~$ ping 192.168.1.10   # verify node is up\n    vagrant@workstation:~$ cd chef-repo/\n    vagrant@workstation:~/chef-repo$ knife bootstrap 192.168.1.10 --ssh-user vagrant --ssh-password 'vagrant' --sudo --use-sudo-password --node-name node1 --run-list 'recipe[learn_chef_apache2]'\n\nAnd to re-run the client:\n\n    $ vagrant ssh workstation\n    vagrant@workstation:~/chef-repo$ knife ssh 192.168.1.10 'sudo chef-client' --manual-list --ssh-user vagrant --ssh-password 'vagrant'\n\nThe host machine's port 8081 is forwarded to the `node` guest VM's\nport 80, so when the provisioning is complete you can view any results\nin your browser at http://localhost:8081/.\n\n#### Troubleshooting\n\n**1. Ensure the node is up**\n\nRun `vagrant up node` before attempting to provision it.\n\n**2. Chef encountered an error attempting to create the client \"node1\"**\n\nIf you destroy and recreate the node locally with vagrant, you'll want\nto delete the corresponding node from the Chef server.  If using\nHosted Chef, delete the node from\n`https://manage.chef.io/organizations/YOUR_ORG/nodes`.  You can do\nthis using the web UI, or can use knife:\n\n    knife node delete \u003cnode_name\u003e --yes\n    knife client delete \u003cnode_name\u003e --yes\n\n**3. ERROR: Your private key could not be loaded from /etc/chef/client.pem**\n\nRun bootstrapping, etc. from the `chef-repo` directory on the workstation.\n\n**4. Net::SSH::HostKeyMismatch**\n\nIf you ssh to the workstation and run `knife bootstrap`, the\nbootstrapped node's fingerprint will be stored in the workstation's\n`~/.ssh/known_hosts` file.  If you destroy and recreate the node,\nsubsequent bootstraps will fail as the fingerprint changes.  Run the\nfollowing on the workstation to allow for re-bootstrapping of the\nnode:\n\n    sed -i 's/192.168.1.10.*//' ~/.ssh/known_hosts\n\n\n## Shutdown\n\nUse `vagrant [halt|suspend|destroy]` to stop your VM(s), depending on\nhow you want to shut down.  See the [Vagrant\ndocumentation](https://docs.vagrantup.com/v2/getting-started/teardown.html)\nfor details.\n\nUsing `vagrant destroy workstation` will *not* delete any recipes or\ncookbooks you're editing in the `chef-repo/`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzohrab%2Flearn_chef_vagrant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjzohrab%2Flearn_chef_vagrant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzohrab%2Flearn_chef_vagrant/lists"}