Questions tagged [cookbook]

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

510 questions
3
votes
1 answer

How to add a cron job entry using Chef recipe

All, I have a shell script that is creates tar file of logs. I have embeded the recipe in the cookbook. The recipe looks like this : cookbook_file "/var/create-tar.sh" do source "create-tar.sh" mode 0755 end execute "create tar files of logs older…
cloudbud
  • 2,948
  • 5
  • 28
  • 54
3
votes
1 answer

Writing file with multiple Chef cookbooks all targeting the same file

I have a situation where I have three cookbooks, each with a template resource that writes to an /etc/hosts file. Rather than overwriting, I would like to append: The first cookbook creates /etc/hosts file and writes lines 1,2,3. The second…
Jacques Betancourt
  • 2,652
  • 3
  • 18
  • 19
3
votes
0 answers

Can we override the Chef default path while deploying rails app

I am trying to deploy rails app through chef . code deployed successfully ,but bundle install throwing error for specific gems , When installed manually gem installs without any issues , as per the chef error i got to know that , to execute bundle…
mbdvg
  • 2,614
  • 3
  • 21
  • 39
3
votes
2 answers

Unable to install librarian-chef cookbooks on Windows 7

I am trying to install librarian-chef cookbooks at the Windows prompt. I have already installed librarian-chef using gem install librarian-chef. However I am getting this error: C:\Users\crmpicco\Documents\vagrant-chef-deploy>librarian-chef…
crmpicco
  • 16,605
  • 26
  • 134
  • 210
3
votes
1 answer

Chef knife site download return ContentLengthMismatch errors

After I upgraded my chef client on mac to version 11.10.4, I couldn't use knife command to download cookbooks. I have latest knife version and latest xcode 5.1 for Mac. Does anyone know what seem to be the issue? $ knife cookbook site list ERROR:…
Nam Nguyen
  • 5,668
  • 14
  • 56
  • 70
3
votes
3 answers

How to append the content in the file for chef cookbook?

I'm new in chef and cookbook. I'm creating a cookbook, and I want to append at the end of file some contents (text). At the moment, I'm using: file "#{node['dir']}/#{params[:name]}.txt" do content "my full text" end but I must always append in…
pasquy73
  • 563
  • 3
  • 13
3
votes
1 answer

Execute two roles and also Can we add two recipes in runlist?

I have created a role myrole inside that i added two receipes under run list "run_list" : [ "recipe[sala::default],[sala::test]" ] But it is giving me error. So later i want to do knife bootstarp ipaddress -x user -i key --sudo - r…
Suresh Sala
  • 425
  • 1
  • 6
  • 17
3
votes
3 answers

No space left on device - write chef remote_file

I get a strange error when a chef-client tries to execute remote_resource for a big local file. From stack trace I guess ruby copy files itself. My disk has a lot of free space. Also var and tmp folders has at leas 2 Gbytes. If I do this job myself…
Daniil Iaitskov
  • 5,525
  • 8
  • 39
  • 49
3
votes
2 answers

how to order query execution with opscode chef and database cookbook

I'm looking for some help on defining a priority in my chef recipe. The recipe is supposed to import a sql dump in a database then execute 2 mysql queries against the database. I'm using Chef Solo. The first mysql_database action :query importing…
3
votes
2 answers

Using modified opsworks deploy cookbook immutable object error

I'm attempting to add some custom code into the opsworks deploy cookbook, related to the before_migrate step: before_migrate do link_tempfiles_to_current_release deploy_version = Time.now.strftime("%Y%m%d%H%M%S") if node['deploy_app'] ==…
3
votes
2 answers

Opscode Chef - way to cleanup /shared/cached-copy

We using Opscode Chef in our pipeline and we notice that the deployment (see http://docs.opscode.com/resource_deploy.html) creates a complete copy of our sourcecode to /shared/cached-copy It already has nearly thousand complete versions of it (not…
Calmon
  • 583
  • 5
  • 18
3
votes
2 answers

ruby chef directive : include_attribute vs. include_attributes

I saw this code at chef attributes file. include_recipe "deployment" include_attribute "postgresql" include_attribute "redis" include_attributes "uaa" include_attributes "service_lifecycle" What's different? include_attribute vs.…
plhn
  • 5,017
  • 4
  • 47
  • 47
2
votes
0 answers

Setting up hashicorp vault in production with chef docker resource

I am trying to setup hashicorp vault in production with chef cookbook. This is what I have in my recipes/default.rb directory '/vault-docker' do action :create end cookbook_file '/vault-docker/config.hcl' do source 'config.hcl' action…
Hakeem Baba
  • 647
  • 1
  • 12
  • 32
2
votes
1 answer

Install Java JDK 1.8 on CentOS using Chef

I'm trying to install Java JDK 1.8 on CentOS 7 using a Chef Cookbook. I'm using Chef DK on Windows 10 and I've donloaded from https://downloads.chef.io/chefdk In my Berksfile I've source 'https://supermarket.chef.io' metadata My Kitchen.yml is…
Cesare
  • 1,629
  • 9
  • 30
  • 72
2
votes
1 answer

How may I determine Java version from inside the Chef custom resource without passing it as a parameter?

I am creating a custom resource and would like to make it as self-contained as possible. I need to determine java version that is going to be available on the node so I will be able to setup JAVA_OPTS variable properly, depending on Java version. I…
Denuil
  • 35
  • 1
  • 4