0

I have two cookbooks "users" and "nginx". First cookbook creates users and folders for system and second cookbook installs nginx for created directories' configuration.

In kitchen.yml file I added "users:default" to run list:

---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    run_list:
      - recipe[users::default]
      - recipe[nginx::default]

and in nginx::default recipe I added include_recipe:

include_recipe "users::default"

But it does not include "users::default" when i run "kitchen converge":

Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 8 resources
       Recipe: nginx::default
         * apt_package[curl] action install
           - install version 7.35.0-1ubuntu2.6 of package curl
         * apt_package[git-core] action install
           - install version 1:1.9.1-1ubuntu0.3 of package git-core
         * apt_package[nginx] action install

What is the problem? Why I can not run "users::default" recipe in another cookbook?

Mehmet Davut
  • 667
  • 10
  • 30

2 Answers2

2

When i use path in berksfile, it is solved:

source 'https://supermarket.chef.io'

metadata

cookbook "users", path: "../../cookbooks/users"
cookbook "swap", path: "../../cookbooks/swap"

This means, use users cookbook in given path, instead of using source url

Mehmet Davut
  • 667
  • 10
  • 30
1

include_recipe will only run a given recipe once, so it can't be both on the run list directly and run via include_recipe. It should still show up in the output though, pastebin your users/recipes/default.rb?

coderanger
  • 52,400
  • 4
  • 52
  • 75