"yum install xxxx" or "apt-get install xxxx" analogy for chef?

Hi,

For our developer boxes, typically the users won’t know chef, and won’t
have a locally configured knife, and these guys would be used to
installing tomcat or some package using the distro specific tool
(apt/yum/emerge).

However for a bunch of packages/services we have chef recipes
specifically to get tomcat6 or others onto CentOS 5.6 boxes e.g.
recipe[tomcat::tomcat6]

Obviously its possible to create a /etc/chef/tomcat.json file and run it
as chef-client -j /etc/chef/tomcat.json such as
{ “run_list” : [“recipe[tomcat::tomcat6]”] }

Or even to open “shef -z” session and apply the recipe interactively. Or
even to run knife as the chef-client user with the client.pem and
client.rb file…

However I am looking for something that can be easily applied as a
one-liner… does such a thing exist as a plugin for chef-client?

chef-client -r “recipe[somecookbook::somerecipe]” would be perfect… :wink:

Thanks
Tom

Simply add to your recipe

package "os-package-name"

2012/1/16 Tom tom@limepepper.co.uk

Hi,

For our developer boxes, typically the users won't know chef, and won't
have a locally configured knife, and these guys would be used to installing
tomcat or some package using the distro specific tool (apt/yum/emerge).

However for a bunch of packages/services we have chef recipes specifically
to get tomcat6 or others onto CentOS 5.6 boxes e.g. recipe[tomcat::tomcat6]

Obviously its possible to create a /etc/chef/tomcat.json file and run it
as chef-client -j /etc/chef/tomcat.json such as
{ "run_list" : ["recipe[tomcat::tomcat6]"] }

Or even to open "shef -z" session and apply the recipe interactively. Or
even to run knife as the chef-client user with the client.pem and client.rb
file...

However I am looking for something that can be easily applied as a
one-liner... does such a thing exist as a plugin for chef-client?

chef-client -r "recipe[somecookbook::**somerecipe]" would be perfect...
:wink:

Thanks
Tom

Oops. You are right. chef-client -j is very unattractive option.

2012/2/21 Akzhan Abdulin akzhan.abdulin@gmail.com

Simply add to your recipe

package "os-package-name"

2012/1/16 Tom tom@limepepper.co.uk

Hi,

For our developer boxes, typically the users won't know chef, and won't
have a locally configured knife, and these guys would be used to installing
tomcat or some package using the distro specific tool (apt/yum/emerge).

However for a bunch of packages/services we have chef recipes
specifically to get tomcat6 or others onto CentOS 5.6 boxes e.g.
recipe[tomcat::tomcat6]

Obviously its possible to create a /etc/chef/tomcat.json file and run it
as chef-client -j /etc/chef/tomcat.json such as
{ "run_list" : ["recipe[tomcat::tomcat6]"] }

Or even to open "shef -z" session and apply the recipe interactively. Or
even to run knife as the chef-client user with the client.pem and client.rb
file...

However I am looking for something that can be easily applied as a
one-liner... does such a thing exist as a plugin for chef-client?

chef-client -r "recipe[somecookbook::**somerecipe]" would be perfect...
:wink:

Thanks
Tom

On 21/02/12 11:29, Akzhan Abdulin wrote:

Oops. You are right. chef-client -j is very unattractive option.

Yeah, I ended up with a wrapper script that is sort of a hack to append
some role or recipe string to the run_list and write it to
/etc/chef/first-boot.json and run chef-client -j
/etc/chef/first-boot.json and then remove it after the script has run.

I considered temporarily changing the run_list to just the recipe I
wanted using the -j options, but it deletes all the local cookbooks from
the cache that are not included, so the next run of the full list takes
ages to re-download etc.

I suspect the answer is involves tinkering with knife to invoke shef or
something like that.

Tom

    For our developer boxes, typically the users won't know chef,
    and won't have a locally configured knife, and these guys
    would be used to installing tomcat or some package using the
    distro specific tool (apt/yum/emerge).

    However for a bunch of packages/services we have chef recipes
    specifically to get tomcat6 or others onto CentOS 5.6 boxes
    e.g. recipe[tomcat::tomcat6]

    Obviously its possible to create a /etc/chef/tomcat.json file
    and run it as chef-client -j /etc/chef/tomcat.json such as
    {  "run_list" : ["recipe[tomcat::tomcat6]"]  }

    Or even to open "shef -z" session and apply the recipe
    interactively. Or even to run knife as the chef-client user
    with the client.pem and client.rb file...

    However I am looking for something that can be easily applied
    as a one-liner... does such a thing exist as a plugin for
    chef-client?


    chef-client -r "recipe[somecookbook::somerecipe]" would be
    perfect... ;-)


    Thanks
    Tom

I assume this still works, but I wrote a cookbook that does what
you're describing. The one-shot cookbook runs a recipe, then removes
it and itself from the run list.
https://github.com/mattray/mattray-cookbooks/tree/master/one-shot

Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
matt@opscode.com | (512) 731-2218
Twitter, IRC, GitHub: mattray

On Thu, Feb 23, 2012 at 9:16 AM, Tom H tom@limepepper.co.uk wrote:

On 21/02/12 11:29, Akzhan Abdulin wrote:

Oops. You are right. chef-client -j is very unattractive option.

Yeah, I ended up with a wrapper script that is sort of a hack to append some
role or recipe string to the run_list and write it to
/etc/chef/first-boot.json and run chef-client -j
/etc/chef/first-boot.json and then remove it after the script has run.

I considered temporarily changing the run_list to just the recipe I wanted
using the -j options, but it deletes all the local cookbooks from the cache
that are not included, so the next run of the full list takes ages to
re-download etc.

I suspect the answer is involves tinkering with knife to invoke shef or
something like that.

Tom

For our developer boxes, typically the users won't know chef, and won't
have a locally configured knife, and these guys would be used to installing
tomcat or some package using the distro specific tool (apt/yum/emerge).

However for a bunch of packages/services we have chef recipes
specifically to get tomcat6 or others onto CentOS 5.6 boxes e.g.
recipe[tomcat::tomcat6]

Obviously its possible to create a /etc/chef/tomcat.json file and run it
as chef-client -j /etc/chef/tomcat.json such as
{ "run_list" : ["recipe[tomcat::tomcat6]"] }

Or even to open "shef -z" session and apply the recipe interactively. Or
even to run knife as the chef-client user with the client.pem and client.rb
file...

However I am looking for something that can be easily applied as a
one-liner... does such a thing exist as a plugin for chef-client?

chef-client -r "recipe[somecookbook::somerecipe]" would be perfect... :wink:

Thanks
Tom