-1

How can I cal a custom recipe from my default recipe? If I try

recipe 'my-base-server'

I get an error 1 argument for 0

What I want to achieve is a logical division of my recipe into base, web-server and app-server. I will setup each recipe as described in the answer below but I want to include these recipes in my default recipe. What I can't figure out is probably dead simple, is how to call the web-server recipe I write from the default recipe. The web server recipe will in turn call the nginx recipe as described below. I am using Berkshelf. I don't want to use roles and nodes. I can't find documentation about how to do this with only wrapper recipes.

Essentially, all I want to know is very basic, how to define a run list in a recipe. I can't find a reference anywhere that doesn't do it from a role or node.

0

2 Answers 2

1

You can use wrapper cookbooks like so (in this case, deploying a Tomcat app):

node.set['java']['install_flavor'] = 'oracle'
node.set['java']['oracle']['accept_oracle_download_terms'] = true
node.set['java']['jdk_version'] = 7


node.set['tomcat']['base_version'] = 7
node.set['tomcat']['loglevel'] = 'WARN'     # default is 'INFO'

tempdir     = node['appname']['temp_dir']
configdir   = node['appname']['config_dir']
loggingconf = node['appname']['logging_conf'] 
grailsenv   = node['appname']['grails_env']
appdir      = node['appname']['app_dir']

if Chef::Config[:solo]
    node.set["tomcat"]["keystore_password"] = 'throwawaypassword'
    node.set["tomcat"]["truststore_password"] = 'throwawaypassword'
end

include_recipe "java"
include_recipe "tomcat"
2
  • In what file is this code? Feb 9, 2014 at 6:56
  • This is in a custom cookbook recipe, in this example, the cookbook is called 'appname'. Honestly, it sounds like you should spend some time on learnchef.opscode.com
    – gWaldo
    Feb 10, 2014 at 0:30
-1

I just needed to namespace the recipe like this

include_recipe 'my-rails-server::web-server'

where the recipe name was

recipes/web-server.rb

My problem was that I had tried this after creating a cookbook by hand and it didn't work. After I used

berks cookbook my-rails-server

it worked fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .