Questions tagged [cookbook]

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

498 questions
4
votes
2 answers

Access chef data bag in recipe

I have created below data bag item: { "name": "data_bag_item_nameservers_servers", "json_class": "Chef::DataBagItem", "chef_type": "data_bag_item", "data_bag": "nameservers", "raw_data": { "id": "servers", "serverslist": [ …
Ravi kumar
  • 119
  • 2
  • 8
4
votes
2 answers

Bump cookbook version - how?

Recently I have developed cookbook and it has got version 0.1.0. Then I have added more recipes for this cook. I want to bump version to 0.2.0. I want to see both version when I do "knife cookbook show test". Please help me how to do this.
Rajan Kumar
  • 688
  • 1
  • 4
  • 9
4
votes
1 answer

In what order is a Chef cookbook executed

I'm trying to get a grasp on chef and for the life of me I cannot find how cook books are run If I have the file structure chef-repo ├── cookbooks │   └── test │   ├── attributes │   │   ├── default.rb │   │   └── test.rb │   ├──…
Chris Barrett
  • 486
  • 3
  • 12
4
votes
1 answer

How can I get chef to reboot the node, and pick up the recipe from where it left off?

I'm trying to set up an asterisk server with chef using Berkshelf and Vagrant, and I'd first like to upgrade the kernel by running apt-get upgrade , and rebooting my machine. How can I trigger a reboot in the recipe, and have it pick up after the…
noli
  • 15,285
  • 7
  • 41
  • 59
4
votes
5 answers

Cookbook not found : Chef Solo

I downloaded the cookbook "oc-java-master" from the Chef community and now I am trying to run it using chef-solo which i have installed on a Windows Server 2008. After a lot of googling and stackoverflow support i was able to get the JSON file…
dharam
  • 7,306
  • 15
  • 59
  • 87
4
votes
1 answer

Recipe not being executed in Chef

I'm making a simple recipe that apt-get upgrades the whole system. include_recipe "apt" execute "apt-get upgrade -y" do command "apt-get upgrade -y" action :nothing end but it never gets run: chef-solo -j node.json -W Recipe:…
Disco
  • 3,846
  • 10
  • 54
  • 76
4
votes
2 answers

Organizing Chef Cookbooks For Different Servers

I have several different servers used for different purposes. Everyone use mysql, but it should be configured a little bit different. => Different users, different databases. I have a cookbook that installes mysql. The question is, where should I…
Draco Ater
  • 19,891
  • 8
  • 60
  • 85
3
votes
1 answer

Is it possible to selectively sync cookbooks with knife bootstrap?

I'm trying to get a server up and running via knife bootstrap via this command: knife bootstrap "" -x ec2-user -r recipe[connector],recipe[all-servers] -N "serv-name" -E staging -i "~/.chef/mycert.pem" --sudo…
Cdhippen
  • 499
  • 7
  • 23
3
votes
1 answer

cannot load such file -- chef/mixin/language

I am testing a cook book on my local machine using Kitchen. I get the below error. Recipe Compile Error in /tmp/kitchen/cache/cookbooks/windows/libraries/windows_package.rb I, [2018-04-18T15:52:46.333373 #55288] INFO -- default-ubuntu-1404:…
3
votes
2 answers

Chef Supermarket cookbooks with no metadata.rb file

When installing / downloading cookbooks from Chef's Supermarket, some cookbooks do include a metadata.json file, however do not include a metadata.rb file. Without the metadata.rb file a user is unable to upload the cookbook to the chef server. My…
J0991
  • 917
  • 2
  • 9
  • 16
3
votes
2 answers

How would I include and configure a ruby library in a Chef recipe?

I want to include the Diplomat gem in my Chef cookbook so that I can perform Consul variable lookups in .erb templates. I need to configure the Consul URL: irb(main):015:0> require 'diplomat' irb(main):016:0> Diplomat.configure do…
asdoylejr
  • 542
  • 1
  • 6
  • 18
3
votes
2 answers

Ruby / Chef: is there a way to refer to the resource 'name' and pass to a function?

Please see the following code, using the log resource in chef. log 'Hello there' do level :info notifies :run, "log_to_chat('Hello there')" end Is there a way to refer to the resource name (in this case: 'Hello there') when I pass it to the…
vikingsteve
  • 34,284
  • 19
  • 101
  • 142
3
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
  • 594
  • 6
  • 22
3
votes
2 answers

Resolving chef-solo cookbook dependencies

I am trying to run chef solo on my workstation to apply some settings locally. My recipe depends on several external cookbooks that I specify in both metadata.rb and Berksfile. The chef-client run fails with the error message below. I'd like to…
Aaron Bandelli
  • 848
  • 2
  • 7
  • 15
3
votes
1 answer

How do I override octopus-deploy's supermarket chef cookbook's tentacle_install_location path?

My current setup: I am creating a cookbook to install Octopus Deploy tentacles onto standard VMs at my company. I have created a new local cookbook called "octopus-deploy-mk6". "mk6" is our company's name and I'm using this recipe to define my…
1 2
3
33 34