A cookbook is the fundamental unit of configuration and policy distribution in Chef.
Questions tagged [cookbook]
498 questions
18
votes
1 answer
specify exact cookbook version in node run_list still possible?
I have this in my notes that {"run_list":["recipe[nginx@1.2.3]"]} is possible to explicitly specify a cookbook version to use in a nodes run_list but i can't get it to work and can't find any documentation to say if this is still supported or if…
![](../../users/profiles/458646.webp)
Flo Woo
- 829
- 1
- 9
- 22
17
votes
8 answers
How to query cookbook versions on a node?
Usage case:
The DevOps team launched a node sometime ago, and my team would like to know what's the version(s) of one/several cookbook(s) being used in the run_list.
Our DevOps team is firefighting so we'd like to find a way to be…
![](../../users/profiles/528884.webp)
digit plumber
- 1,094
- 2
- 14
- 26
16
votes
1 answer
how to require my library in chef ruby_block
I'm developing a cookbook to deploy a simple ROR application. I write an app_helper.rb and put it into the libraries directory of my cookbook, here is the content:
module AppHelper
def self.find_gem
if…
![](../../users/profiles/3145656.webp)
Xiaoming
- 531
- 2
- 7
- 17
15
votes
2 answers
Installing multiple packages via Vagrant + Chef
I've just discovered Vagrant + Chef and I'm trying to create a simple recipe to install multiple packages on the node. I thought something like this could work (I'm completely new tu ruby):
# (From cookbooks/MY_COOCKBOOK/recipes/default.rb)
#…
![](../../users/profiles/169754.webp)
Roberto Aloi
- 28,818
- 19
- 65
- 109
12
votes
1 answer
How can I use my sql knowledge with Cloudant/CouchDB?
Some developers who have a good knowledge of querying SQL databases struggle to implement the equivalent query patterns in Cloudant/CouchDB.
How can these developers translate their SQL knowledge to Cloudant/CouchDB?
![](../../users/profiles/1033422.webp)
Chris Snow
- 20,818
- 29
- 115
- 263
11
votes
3 answers
Chef - Test for cookbook_file existence
Is there any way to test that a given cookbook_file exists in a chef recipe? I would like to do something like the following:
cookbook_file "/etc/cron.d/#{service}" do
source "etc/cron.d/#{service}"
owner "root"
group "root"
mode…
![](../../users/profiles/52550.webp)
Marc
- 749
- 5
- 16
10
votes
3 answers
Resolving and downloading chef cookbook dependencies
Let's say I want to use a community cookbook (i.e. http://community.opscode.com/cookbooks/gerrit). So I will download it using 'knife cookbook site download ' and upload to my local chef server. I need to repeat this step for every direct and…
![](../../users/profiles/1253306.webp)
Henrique Gontijo
- 846
- 2
- 12
- 26
7
votes
2 answers
How to pass environment variables to test kitchen in .kitchen.yml
I am trying develop a cookbook to make a flask app work with gunicorn and nginx. I have been successful to the point that the app is running very well with a local sqlite database, see my cookbook at https://github.com/harrywang/flasky-cookbook. The…
![](../../users/profiles/4258228.webp)
dami.max
- 185
- 1
- 13
7
votes
1 answer
Chef cookbook version delete, or update specific version
I have long history of a cookbook that has a recipe of the app and is constantly modified. It got to the point where cookbook version is 226. I'm wondering how can upload files to specific cookbook version. I appreciate your help!
![](../../users/profiles/3692800.webp)
user3692800
- 73
- 1
- 3
7
votes
1 answer
Extract cookbook name and version during chef-client run
Please help me with the recipe to pull the cookbook name and version during the chef-client run. I want to store the values to variables and use as part of my recipe.
I am finding difficulty on how to pull the cookbook version and name from the…
![](../../users/profiles/3493086.webp)
thecontent
- 81
- 1
- 3
7
votes
3 answers
what is the best way to run chef-client in specific intervals
Currently I am using open source chef and having number of nodes chef client is installed. I want the chef client to run in specific intervals. Any good cookbooks out there to configure it.
![](../../users/profiles/2907237.webp)
user88975
- 560
- 1
- 7
- 18
7
votes
3 answers
Attribute precedence in chef cookbook
I am trying to implement a wrapper cookbook by taking inspiration from How to Write Reusable Chef Cookbooks, Gangnam Style. I wish to install tomcat 7 on my node without manager app. I have created a wrapper cookbook with the following…
![](../../users/profiles/1014559.webp)
Vaibhav
- 569
- 6
- 30
7
votes
1 answer
How do you modularize a Chef recipe?
Here is an example of a working recipe that loops through an array of website names and creates them in IIS using the function createIisWebsite().
def createIisWebsite(websiteName)
iis_site websiteName do
protocol :http
port 80
…
![](../../users/profiles/139975.webp)
Janaka
- 198
- 2
- 10
6
votes
4 answers
How to make newly created user as sudo user by using chef
I have created a user 'testuser' by using chef. How to make this user as sudo user?
![](../../users/profiles/7025945.webp)
Sampath
- 137
- 2
- 10
6
votes
6 answers
function which allows only name arguments
I read a solution in the Python Cookbooks for creating a function that only allows name arguments. I wrote my own code to try it out:
class Reporter(object):
def __init__(self, *, testline=None, sw_ver= None, directory=None):
pass
if…
![](../../users/profiles/4284769.webp)
Bartłomiej Bartnicki
- 857
- 11
- 25