sdanna
activity item
Feb 26
New Cookbook Version
systemd
Installs/Configures systemd
more →
Feb 26
New Cookbook
systemd
Installs/Configures systemd
more →
Nov 09
New Cookbook Version
r-project
Installs/Configures R
more →
Nov 09
New Cookbook Version
r-project
Installs/Configures R
more →
Nov 09
New Cookbook
r-project
Installs/Configures R
more →
Jul 24
New Answer
ETIMEDOUT Connection Error
It is likely that the IP address chosen by Ohai as the value for the "ipaddress" attribute is the private IP address for the instance. The best way to get around this is to use the `-a` attribute to use the `ec2.public_hostname` attribute: knife ssh name:i-ee959e97 -x ubuntu “sudo chef-client” -a ec2.public_hostname -i “C:\chef-repo\MyKeys.pem” Ohai's EC2 plugin collects a variety of data about your instance, including its public and private network information.
more →
2012
New Answer
Perform group command like fabric
Currently the best chef-centric way to accomplish this does indeed require a chef-server. Using knife-ssh, you can use the Chef Server's Search API to return a set of your nodes, and then run commands against all of the nodes returned. For example, to run apt-get update on all of your nodes: knife ssh '*:*' 'sudo apt-get update" Or, to run it only on your Ubuntu nodes: knife ssh 'platform:ubuntu' "sudo apt-get update"
more →
2012
New Answer
Correct way to handle cookbooks depenency?
My personal opinion is that the right thing to do would be to determine why the error is happening and resolve the issue. While I still wouldn't recommend cloning the entire cookbook repository as the person in the Stack Overflow question did, typically a cookbook should be able to be loaded without error even if it is not going to be used. Chef and Ruby provide ample means of ensuring certain actions are only taken on certain platforms and of catching errors and handling them gracefully.
more →
2012
New Answer
passenger_apache2: passenger-install-apache2-module not found on ubuntu
I think that either 1. Using the full path to the executable in the execute statement, or 2. Appending the necessary path to the PATH environment variable and passing this to the resource via the environment resource attributes are the most straightforward solution to this problem. In the end, this sounds like a bug in the cookbook that you might want to file at http://tickets.opscode.com under the COOK project.
more →
2012
New Answer
Regarding Cookbook
It appears that the opscode-maintained community cookbooks for these three pieces of software have not been generalized to allow you to install any version. However, you can use these cookbooks as a starting place for installing the specific versions you need. If the version you need is contained in your linux distributions repository, you could modify the recipes of each of these cookbooks to pass the `version` resource attribute to the package resource that is installing the recipe. For more information about the package resource, see the following wiki page: http://wiki.opscode.com/display/chef/Resources#Resources-Package The above documentation has examples of using the package resource to install a specific version of software. In most cases, you will want to make the version an attribute that you pass to the resource. This allows you to change the version you need installed simply by changing an attribute. If the version you need isn't in your distributions repository, you may need to install it from source. The PHP::source recipe has a good example of how you can do this: https://github.com/opscode/cookbooks/blob/master/php/recipes/source.rb In fact, for PHP itself, you can likely install the version you need by modifying the attributes highlighted here: https://github.com/opscode/cookbooks/blob/master/php/attributes/default.rb#L44-47 If you are interested in learning more about how recipes are written in general, you might want to check out http://wiki.opscode.com/display/chef/Guide+to+Creating+A+Cookbook+and+Writing+A+Recipe
more →
2012
New Answer
using a resource from a different cookbook
A cookbook can depend on another cookbook in a number of ways. Here are the two most common ways: 1. Cookbook A depends on the LWRP, definition, or library from cookbook B. 2. A recipe in cookbook A depends on the the resources defined inside a recipe of cookbook B, either to set up prerequisites on the system, or to provide resources that can be notified. In both cases you should place the following in the metadata.rb file: depends 'name_of_cookbook_b' In case 2, you also need to include the following at the top of the recipe in cookbook A: include_recipe 'name_of_cookbook_b::name_of_needed_recipe'
more →
2012
New Answer
Overriding attributes referenced by other attributes
The problem you are running into is the result of how attributes are loaded during a Chef run. In order to maintain the documented attribute precedence. Attributes from roles and environments are loaded after attribute files are loaded. Thus at the time you are accessing that attribute within the attribute file, the role has not yet been loaded. We typically recommend that interactions between attributes (such as concatenation) are done inside recipes to ensure that the final attribute value is being used. However, this does sometime interfere with the most straightforward way to define your attributes. Other then moving the interaction to a recipe, it is possible to force the role and environment attributes to be evaluated using the following at the top of your attribute file: apply_expansion_attributes(expand!) However, we do not typically recommend this as it ties your recipes to an particular implementation detail of the current version of Chef (which could easily change) and since it means that you may run into situations in which your chef client run is not applying attributes with the documented precedence.
more →
2011
New Answer
Sharing code, definitions and other helpers between cookbook repos
One nice way to accomplish this is to create a set of "library" type recipe's that define the definitions, LWRP, and other shared resources. Other recipe's in which you wanted to do these things should do the following: 1. Define the "library" recipe as a dependency in metadata.rb via the `depends` keyword: {code} depends "library-cookbook" {code} 2. Use the `include_recipe` DSL function inside a recipe: {code} include_recipe "library-cookbook" {code} This will ensure that all of library-cookbook's LWRPs, libraries, and definitions are available in the recipe that depends on them. I hope this helps.
more →
2011
New Answer
TypeError: can't convert Array into String - ruby 1.9.2
In version of Chef 0.10.x prior to version 0.10.6, this is the error you receive if knife can't find the bootstrap file you specified. I have seen this error caused by two related situations: 1. Simply mispelled or missing bootstraps. Note that in the example in tis question, the bootstrap is ubuntu10.04-ruby192 but that the file is ubuntu10.04_ruby192.erb. The "-" should be a "_" 2. As ahawthorne mentioned, not running the knife bootstrap command from the top of your Chef repository. Prior to 0.10.6, knife-bootstrap naively looked for custom bootstraps in the relative path ".chef/bootstrap/". The second issue is fixed in 0.10.6 and a more informative error message should be seen in the case of the first issue as well.
more →