Supermarket is the Chef community’s central clearing house for sharing cookbooks, tools, and plugins. It is a place for Chef community members to download community cookbooks, collaborate on cookbooks, and upload cookbooks to be used by other community members.
Here we’ll learn how to download “ntpd” cookbook from chef supermarket and use it.
- You have already installed chef Development kit on chef workstation.
- You have already setup chef account and have downloaded check starter kit and unzipped it on chef workstation.
- You have already bootstrapped your client node
- Your cookbook directory is configured to be part of git repository.
Please follow steps in sequence:
- Install git on your workstation server and initialize it.
2. Connect your cookbooks directory to remote bitbucket repository called “cookbook”:
[git remote add origin firstname.lastname@example.org:rajeevkghosh/cookbook.git]
3. Now perform git pull/ push operation so that your local repository gets synced with remote repository
4. Now add everything inside cookbook to be part of git and commit it.
5. Check the git status again, you will see nothing to be committed.
6. Now visit “https://supermarket.chef.io/” and search for “ntpd”
This can also be searched by using below command:
[knife cookbook site search ntpd]
You will see different cookbooks ntp. We will use “ntpd” in this example
7. Now run below command. it will download the cookbook called “ntpd”
8. You will see something like cookbook ntpd version 0.2.1 successfully installed.
[Note: This will not actually perform the ntpd installation, its mere notification that the ntpd cookbook with all required files have been downloaded from supermarket.]
9. You will see ntpd directory has been created. it has all the required pre-written files.
10. Go inside “ntpd/recipes” directory and cat the default.rb file, you will see pre-written cookbook to install and configure ntp. Make necessary changes as per your need.
[ For simplicity purpose, we are not making any changes.]
11. Now upload the cookbook to your chef server.
12. Verify that the cookbook is uploaded to chef server:
13. Add your client node to the run list “ntpd”
14. Now go to your client node and run “chef-client” it retrieves the cookbook from the Chef server and executes it on the node. You will see ntp getting installed and configured.
15. Verify that ntpd is up and running on the client node:
We are all done.