chef solo setup
chef-solo
Chef-Solo is an open-source tool that runs locally and allows to provision of guest machines using Chef cookbooks without the complication of any Chef client and server configuration. It helps to execute cookbooks on a self-created server. Before running Chef-Solo on the local machine, one needs to install the following two files on the local machine.
*Solo.rb − This will explain Chef concerning where to discover cookbooks, roles, and data bags.
*Node.json − This document sets the run list and any node explicit attribute, whenever required.
solo.rb configuration
Following are the steps to configure solo.rb.
step1:Create a solo.rb file inside the chef-repo.
current_dir = File.expand_path(File.dirname(__FILE__))
file_cache_path "#{current_dir}"
cookbook_path "#{current_dir}/cookbooks"
role_path "#{current_dir}/roles"
data_bag_path "#{current_dir}/data_bags"
Step2:Add the file to the git repo.
#git add solo.rb
step3:Generate a node.json file inside the chef-repo with the following script.
{
"run_list": [ "recipe[ntp]" ]
}
Step4:Get the NTP cookbook inside the chef-repo using the knife.
#knife cookbook site install ntp
Step5:Let adds the node.json file to Git.
#git add node.json
Step6:Commit and push the files to the git repo.
#git commit -m "chef-solo"
#git push
Github repo for:https://github.com/zippyopstraining/chef-solo
Running the Cookbook on the Node
Let’s run the Cookbook on the Node, Login to the node where one wants to provision the Chef-Solo.
*Clone the Chef repo on the machine.
#git clone $URL_PATH
*cd to the chef-repo.
#cd chef-repo/
Run the Chef-Solo to converge the node–
#chef-solo -c solo.rb -j node.json
solo.rb configures Chef-Solo to look for its cookbooks, roles, and data bags inside the current directory: the Chef repository.
Chef-Solo takes its node configuration from a json file. In our model, we called it node.json. On the off chance that you will manage distinctive servers, you'll require an alternate report for each node. By then, Chef-Solo just executes a Chef run reliant on the configuration information found in solo.rb and node.json.
Relevant Blogs:
Recent Comments
No comments
Leave a Comment
We will be happy to hear what you think about this post