Vinay Wadagavi
Vinay Wadagavi

Reputation: 419

How to run the jenkins cookbook downloaded from chef supermaket?

I'm new to using Chef to bootstrap a Node. I have an ubuntu server. In that i wanted to install Jenkins using jenkins cookbook available in supermarket. For that i added the following commands.

$ knife cookbook site download jenkins

and

$ knife cookbook site install jenkins

I want to know how to run those recipes now.

Upvotes: 1

Views: 1403

Answers (2)

Mark O'Connor
Mark O'Connor

Reputation: 77961

Normally you would run a chef server containing the cookbooks and "bootstrap" nodes against this server.

It is possible to run chef locally, but you'll need to install the chefdk, which includes berkshelf for cookbook dependency management.

Step 1: Create Berkshelf file

Berkshelf file to specify the cookbooks to be downloaded:

$ cat Berksfile
source "https://supermarket.chef.io"

cookbook "jenkins"

Step 2: Run chef-client in local mode

# Download cookbooks to local "cookbooks" directory
berks vendor cookbooks

# Run chef client in "local mode" 
sudo chef-client -z -r "jenkins::master"

Upvotes: 1

justMiles
justMiles

Reputation: 573

To run a cookbook locally you need to use chef-solo or chef-zero. Invoke chef-zero with the -z argument and pass in a run list with the -o argument.

chef-client -z -o "recipe[jenkins::master]"

You would typically want to wrap a community cookbook in a wrapper cookbook so that you can customize various options.

Upvotes: 1

Related Questions