Search code examples
chef-infrachef-recipe

chef runlist no such cookbooks


I create a cookbook with chef and when i use runlist i have this error

Missing Cookbooks:
------------------
No such cookbook: apache

i create the cookbook like this

chef generate cookbook apache 

in my server.rb i have juste this

package 'httpd' do
  action :install
end

i try to write my commande line a multiple hawks

sudo chef-client -z --runlist recipe["apache::server"]
sudo chef-client -z --runlist "recipe[apache::server]"
sudo chef-client -z --runlist ["apache::server"] 
sudo chef-client -z --runlist "[apache::server]"
sudo chef-client -z --runlist "apache::server"

but i still have this error

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: apache

Expanded Run List:
------------------
* apache::server

System Info:
------------
chef_version=13.8.5
platform=centos
platform_version=7.1.1503
ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
program_name=chef-client worker: ppid=23940;start=18:20:14;
executable=/opt/chefdk/bin/chef-client

When i run the commande without rulist

sudo chef-client -z cookbook/apache/recipes/server.rb

it work perfectly

the tree commande look like this

├── cookbook
│   ├── apache
│   │   ├── Berksfile
│   │   ├── chefignore
│   │   ├── LICENSE
│   │   ├── metadata.rb
│   │   ├── nodes [error opening dir]
│   │   ├── README.md
│   │   ├── recipes
│   │   │   ├── default.rb
│   │   │   └── server.rb
│   │   ├── spec
│   │   │   ├── spec_helper.rb
│   │   │   └── unit
│   │   │       └── recipes
│   │   │           └── default_spec.rb
│   │   └── test
│   │       └── integration
│   │           └── default
│   │               └── default_test.rb
│   └── nodes [error opening dir]
└── nodes [error opening dir]

Solution

  • it is because your cookbook file is named cookbook and rename cookbooks