Questions tagged [cookbook]

A cookbook is the fundamental unit of configuration and policy distribution in Chef.

510 questions
6
votes
2 answers

Chef Ruby loop over attributes in an .erb template file

So this might be a little confusing but bear with me. In short I want to loop over all attributes with a certain key value and then insert them into a template if the values are not empty. Here is my code: ATTRIBUTES: # === Default file…
jarsever
  • 690
  • 1
  • 7
  • 15
6
votes
5 answers

Modifying php.ini setting with chef php cookbook

I have installed the PHP Cookbook from opscode and the chef-dotdeb cookbook found at chef-dotdeb so that I can run PHP 5.4 in the vagrant box. I would like to modify some of the default php.ini settings. According to the documentation for the chef…
BNK
  • 91
  • 2
  • 6
5
votes
0 answers

Unable to use jenkins cli using ssh protocol via a chef cookbook (it works manually)

I am using ssh as protocol to connect to jenkins via cli . The same command is working when run manually , but fails via my cookbook . server # java -jar /opt/tomcat/webapps/ROOT/WEB-INF/jenkins-cli.jar -s http://localhost:8181/ -ssh -user update -i…
5
votes
2 answers

Unable to find Cookbooks in local-mode with chef-client

I am new to Chef and following a tutorial which is providing information on running a default recipe inside a cookbook or a specific recipe. The tree output for my Cookbook is as follows: pwd /opt/dk-chef/python_code/Chef [root@LUMOS Chef]# tree…
John Squarry
  • 81
  • 1
  • 9
5
votes
1 answer

chef - using recipes from same cookbook

I have cookbook base and cookbook myapp base has 2 recipes - my_java and java_with_custom_stuff in java_with_custom_stuff I want to use the recipe for my_java (same cookbook). something like include_recipe 'my_java' bash 'custom stuff'…
Nick Ginanto
  • 31,090
  • 47
  • 134
  • 244
5
votes
2 answers

How to use library module in Cookbook recipes

In a cookbook I have a library(client_helper.rb). A module is defined inside it. Module name is Client_helper. Here is the module code. module Client_helper # This module contains helper methods def network_zone Chef::Log.debug('network…
Biswajit Das
  • 644
  • 7
  • 26
5
votes
3 answers

Chef-Client tries to install Java on Windows but it is already installed

I'm new to Chef and want to install Java on a windows machine with it. There is a ready-to-use Java cookbook I'm using. So I wrote a wrapper cookbook, as mentioned in another question here. I added the java-cookbook-dependencies and used the…
Bohne
  • 4,029
  • 1
  • 16
  • 22
5
votes
2 answers

Install mysql cookbook with Vagrant and Chef Solo

I'm having a really hard time figuring out how to install mysql cookbook (https://supermarket.chef.io/cookbooks/mysql) I've followed the instructions, but it's the first time i use Vagrant and Chef, and I keep getting stuck while installing the…
Ernie
  • 972
  • 1
  • 10
  • 23
5
votes
1 answer

test-kitchen won't reference local cookbooks

I'm trying to test a cookbook that depends on three other local cookbooks. My directory structure looks like this: /cookbooks/ cookbook_test/ recipes templates metadata.rb cookbook_dep1/ cookbook_dep2/ cookbook_dep3/ My…
5
votes
4 answers

chef cookbook fails on ohai undefined method `[]' for nil:NilClass

I'm working on a chef cookbook to set up a vanilla ubuntu 12.04.2 with nginx postgresql and unicorn on my vagrant box, but I'm getting into troubles with nginx, there's an exception undefined method `[]' for nil:NilClass when installing it that…
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
5
votes
3 answers

Chef does non sequential recipe execution

I followed tutorial http://gettingstartedwithchef.com/, chapter 1. My run list is "run_list": [ "recipe[apt]", "recipe[phpap]" ] My default recipe of phpap cookbook include_recipe "apache2" include_recipe "build-essential" include_recipe…
Daniil Iaitskov
  • 5,525
  • 8
  • 39
  • 49
5
votes
1 answer

Nginx cookbook v 2.0.0: Cookbook http_gzip_static_module not found

I'm using berkshelf to manage cookbooks, chef 11.6.2, and nginx cookbook v 2.0.0 my settings to compile nginx from source: set[:nginx][:source][:modules] = ["http_gzip_static_module", "http_ssl_module"] The provisioning gives me the error: Cookbook…
DungHuynh
  • 118
  • 1
  • 7
5
votes
2 answers

Installing a gem after native extension packages during chef execution

I am trying to install the fog gem in a chef recipe though the gem installation occurs before the native packages are being installed so the gem installation fails package "libxslt-dev" package "libxml2-dev" chef_gem "fog" This is the output [Thu,…
vervas
  • 457
  • 4
  • 12
5
votes
2 answers

Vagrant - how to print Chef's command output to stdout?

If we have in Chef cookbook code like: if !File.exists?('/vagrant/project/target/project/WEB-INF") || node[:compile_project] bash "build project" do user "vagrant" cwd "/vagrant/project" code <<-EOH mvn clean mvn…
Wojciech Bednarski
  • 6,033
  • 9
  • 49
  • 73
4
votes
1 answer

ERROR: undefined method `python' for #

I am newbie to chef. I try install python by chef into Amazon EC2. I made a node in chef-repo/nodes folder something as mynode.com.json I have a run_list in mynode.com.json: "run_list": [ "recipe[python]" ], Then I call: "knife solo cook…
1
2
3
33 34