Jeff Byrnes | 29 Jun 22:40 2015

Re: Re: Re: Java cookbook from the Chef Supermarket

Kurt:

You might also, rather than using a role, just set the attributes in your cookbook where you `include_recipe ‘java’`. That’s a simple version of the wrapper cookbook pattern, which will allow you to keep all of your settings together with the cookbook that installs the packages you need.

Starting from your cookbook’s root, you’d have:

attributes/default.rb:

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

recipes/default.rb:

```
include_recipe 'java'
```

This will have the same effect as the role you’ve built, while simplifying things, and consolidating the settings you want. You might also include all of the package installations in your cookbook recipe as well, using the `package` resource.

-- 
Jeff Byrnes
<at> thejeffbyrnes
Lead DevOps Engineer
704.516.4628

On June 28, 2015 at 9:44:25 PM, Kurt Andrews (kurt.w.andrews <at> gmail.com) wrote:

Tensibai,

That helped. I moved the roles directory up under my chef-repo, told chef_zero where to find it, and changed the add_recipe to add_role. Everything works now, and I can move on to the installation of the packages I'm really interested in.

On Sun, Jun 28, 2015 at 4:12 PM Tensibai Zhaoying <tensibai <at> iabis.net> wrote:


Le 28 juin 2015 21:18, Kurt Andrews <kurt.w.andrews <at> gmail.com> a écrit :
>
> I'v only been using chef for a few hours, and the learning curve seemed really easy until... 
>
> I'm trying to right a recipe that installs several software packages on an Ubuntu 12.04 virtual machine.  The first thing it needs to do is install Oracle JDK 7.  I decided to try to use the java cookbook in the Chef Supermarket.  after looking at the documentation, I added a base role to my cookbook that looks like this (base.rb):

Unless you stated an error there,  you problem is here, a role is something aside the cookbook, not within. It's part of the runlist. I'm not comfortable to give links from phone, try a search on http://docs.chef.io for the node runlist, roles and cookbook and feel free to ping the list back with details of your cookbook and what you did ;)

>
> name "java"
> description "Install Oracle Java on Ubuntu"
> override_attributes(
>   "java" => {
>     "jdk_version" => '7'
>     "install_flavor" => "oracle"
>     "oracle" => {
>       "accept_oracle_download_terms" => true
>     }
>   }
> )
> run_list(
>   "recipe[java]"
> )
>
> I expected the run list to execute the java::default recipe when chef_zero ran mine.  That didn't happen.  I added the following line to my recipe, the only thing in my default.rb at the moment:
>
> include_recipe "java"
>
> That got me a little farther.  I'm now getting the following output when I vagrant up:
>
> ==> default:  27:  include_recipe "java::set_attributes_from_version"
> ==> default:  28:  include_recipe "java::#{node['java']['install_flavor']}"
> ==> default:  29:  
> ==> default: 
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: Running exception handlers
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: Exception handlers complete
> ==> default: [2015-06-28T11:27:27-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
> ==> default: [2015-06-28T11:27:27-07:00] ERROR: undefined method `[]' for nil:NilClass
> ==> default: [2015-06-28T11:27:28-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>
> chef-stacktrace.out points to line 21 of java::default.rb
>
> First and foremost, what am I missing?  Something isn't getting defined, but I can't tell what it is, or where to define it.
>
> The second question is what is the run_list for in a role, and when does it get processed? What kicks it off?
>
> Thanks in advance for straightening me out.
>
> Regards,
>
> Kurt
>

Martin Smith | 29 Jun 20:46 2015

Upcoming cookbook release: Elasticsearch 1.0.0

Ohai Chefs!

The elasticsearch cookbook has undergone a drastic rewrite in the last month or two, switching from recipes to a resource and provider model. We've also greatly simplified the code, and hope to continue to do so, though this will definitely impact some features that behaved inconsistently or were difficult to maintain.

Later this week, we plan to move the current master branch to a maintenance-only branch, and move the rewritten cookbook to master. After a few days, we will also push the new cookbook version to Supermarket. Before the release to Supermarket happens, we would love to have your feedback on the branch.

The 'next' / rewritten branch can be found at:
https://github.com/elastic/cookbook-elasticsearch/tree/next

Feedback can be submitted by emailing us off list or using:
https://github.com/elastic/cookbook-elasticsearch/issues/new

Once we release the new version to Supermarket, you will find it at the usual place:
https://supermarket.chef.io/cookbooks/elasticsearch

Many thanks to all who have contributed to the rewrite/reworking.

Cheers,

- Martin


Mike | 29 Jun 14:04 2015
Picon

Cookbook Release: aws v2.7.2

Ohai Chefs!

The aws cookbook has just been released at version 2.7.2, which aims to be a bug-fix only release.

Big thanks to all contributors!

You may find the updated cookbook here: https://supermarket.chef.io/cookbooks/aws/


Best,
-M
Kurt Andrews | 28 Jun 21:18 2015
Picon

Java cookbook from the Chef Supermarket

I'v only been using chef for a few hours, and the learning curve seemed really easy until... 

I'm trying to right a recipe that installs several software packages on an Ubuntu 12.04 virtual machine.  The first thing it needs to do is install Oracle JDK 7.  I decided to try to use the java cookbook in the Chef Supermarket.  after looking at the documentation, I added a base role to my cookbook that looks like this (base.rb):

name "java"
description "Install Oracle Java on Ubuntu"
override_attributes(
  "java" => {
    "jdk_version" => '7'
    "install_flavor" => "oracle"
    "oracle" => {
      "accept_oracle_download_terms" => true
    }
  }
)
run_list(
  "recipe[java]"
)

I expected the run list to execute the java::default recipe when chef_zero ran mine.  That didn't happen.  I added the following line to my recipe, the only thing in my default.rb at the moment:

include_recipe "java"

That got me a little farther.  I'm now getting the following output when I vagrant up:

==> default:  27:  include_recipe "java::set_attributes_from_version"
==> default:  28:  include_recipe "java::#{node['java']['install_flavor']}"
==> default:  29:  
==> default: 
==> default: [2015-06-28T11:27:27-07:00] ERROR: Running exception handlers
==> default: [2015-06-28T11:27:27-07:00] ERROR: Exception handlers complete
==> default: [2015-06-28T11:27:27-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-06-28T11:27:27-07:00] ERROR: undefined method `[]' for nil:NilClass
==> default: [2015-06-28T11:27:28-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

chef-stacktrace.out points to line 21 of java::default.rb

First and foremost, what am I missing?  Something isn't getting defined, but I can't tell what it is, or where to define it.

The second question is what is the run_list for in a role, and when does it get processed? What kicks it off?

Thanks in advance for straightening me out.

Regards,

Kurt

Kevin Keane Subscription | 28 Jun 20:50 2015

Chef server update went wrong - how to repair?

A few weeks ago, I finally updated from chef 11 to chef 12 (I believe it was 12.0.3 at the time). The upgrade went smoothly and without a hitch that I could tell.

A few days ago, I updated to chef-server-core 12.1.0, and all hell broke loose. Well, not all hell, but some critical parts of chef aren't working.

The RPM told me that it detected chef 11, and to run chef-server-ctl update. I wasn't sure why it still saw chef 11 since I already upgraded to 12 a while ago, but I followed the instruction.

Now my chef client runs are failing with an "internal service error". knife node show works without a problem, so he node data actually exists.

I haven't found anything that seemed relevant in any log files, but then I'm ot sure what I'd be looking for. I did see error 500s in the nginx logs for the URL: POST /organizations/myorganization/environments/_default/cookbook_versions HTTP/1.1

How do I go about troubleshooting and fixing this?


Here is what happens on one of my clients:

Starting Chef Client, version 12.3.0
resolving cookbooks for run list: [ <redacted - the run list is correct> ]

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

Unknown Server Error:
---------------------
The server had a fatal error attempting to load the node data.

Server Response:
----------------
internal service error


Running handlers:
Running handlers complete
Chef Client failed. 0 resources updated in 108.207621603 seconds



Kevin Keane

The NetTech

760-721-8339

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html


Joe Nuspl | 27 Jun 19:28 2015

Chef-DK build failure

A process question…

I have a PR,  https://github.com/chef/chef-dk/pull/441, but the AppVeyor build is failing.  This seems to be an ecosystem error and not due to my change:

Installing chef 12.4.0 with native extensions
 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby200/lib/ruby/gems/2.0.0/gems/win32-eventlog-0.6.3/lib/win32/eventlog.rb:211: [BUG] Segmentation fault

Once the upstream issue is resolved, do I need to retrigger the AppVeyor build (by pushing a dummy commit) or will it automatically happen?

Thanks.

Joe
Joseph Djomeda | 27 Jun 14:06 2015

chef-solo apache2 install doesn't enable default site

Hello Guys,

I have been doing a full start from scratch all day chef series in order to start the week with team members and eventually using it through opsworks.

I have an intermediate experience with ansible so I kind of have the big picture with configuration management.

I started with a very modest article from gettingstartedwithchef.com I have already managed to get into trouble. I am running this in vagrant with trusty. I have 2 interfaces Nat and hostonly so I can talk to the vagrant box via it own IP.

My recipe/default.rb really has :
include_recipe 'apache2'

apache_site 'default' do
  enable true
end

What I have noticed is that there is only default-ssl.conf in the sites-available folder and nothing in the sites-enabled folder. As at now I have no idea as to how this happened. I wouldn't want to start rolling out my own virtuahost template because I really want to make sure I follow the steps.

I might switch to another tutorial for the mean time but it will be useful for my own sake to find out what happened and how to debug etc. I will be grateful if anybody and land a hand.

In the meantime any other updated and useful step by step resource on chef is welcome.

Thanks in advance
Best Regards,

Joshua Timberman | 27 Jun 06:40 2015

Re: Re: Introducing chef-ingredient

Sure. You can use it with Chef Zero for sure - that's what the test kitchen tests do in the chef-server cookbook.


You can also use the cookbook from another Chef Server. For example I used Hosted Chef with my ChefConf demo when this was the "chef-server-ingredient" cookbook.


On Fri, Jun 26, 2015 at 7:21 AM, Thomas Fee <gasbeing <at> gmail.com> wrote:
Is this designed to be run from Chef Zero the first time if I wanted to bring up a Chef Server the first time?

On Thu, Jun 25, 2015 at 11:32 PM, Joshua Timberman <joshua <at> chef.io> wrote:
Ohai, Chefs!

I'd like to introduce a new cookbook for managing Chef's products (Chef Server, Analytics, etc), chef-ingredient. You may be familiar with the chef-server-ingredient cookbook, and wonder why we have yet another cookbook for this.

We feel it should be easy to manage our products. We also feel that users shouldn't need to know as many underlying details when we can create reasonable, simple abstractions. The chef-ingredient cookbook has three resources to facilitate this:

* chef_ingredient: manages a Chef product installation, and can populate its configuration. For example `chef-server` and `/etc/opscode/chef-server.rb`.
* omnibus_service: manages a sub-service in an omnibus server product. For example, `chef-server/rabbitmq`.
* ingredient_config: manages the configuration file for the specified product using the config from the corresponding `chef-ingredient`.

The cookbook itself is shared on Supermarket and GitHub. The README.md describes the resources in more detail.


For examples of use, see the test cookbook in the repository. Along with this cookbook, we have added two additional cookbooks for managing the apt or yum repositories for the Chef products. These leverage the apt_repository and yum_repository resources using attribute-driven recipes, so users can implement alternate repositories (such as internal).


All three of these cookbooks are intended to be very well tested, and serve as examples, too.

We're working to update the chef-server and chef-server-cluster cookbooks to use chef-ingredient soon - in the next week or so.

Cheers,
Joshua


Joshua Timberman | 26 Jun 23:12 2015

Upcoming change to chef-server cookbook

Hello!

As I said in yesterday's post introducing the chef-ingredient cookbook, we're going to refactor it to use the new ingredient_config resource for managing /etc/opscode/chef-server.rb. That work is reflected in this pull request:


The change to the `configuration` attribute - making it a string instead of a hash - will mean this is a breaking change, and will require a major version bump of the cookbook. The current version is `3.1.1`, therefore the next release of this cookbook incorporating this change will be `4.0.0`. If you're using this cookbook, AND using the `configuration` attribute especially, pin your version, or be ready to modify your attribute use.

We plan to release the new version of the cookbook sometime next week.

Cheers,
Joshua

Fouts, Chris | 26 Jun 22:29 2015

Need info on chef handler warning please?

I’m playing with Chef handlers, and have the following in a recipe, which simple creates an empty /tmp/node_is_bootstrapped.txt file, and it works.

 

chef_handler 'Chef::Handler::ReportNodeBootstrapped' do

  source "/tmp/some_handler.rb"

  supports :report => true

  action :enable

end

 

However, I get this warning

 

chef_handler[Chef::Handler::ReportNodeBootstrapped] action enable[2015-06-26T16:09:08-04:00] WARN: Using an LWRP by its name (Chef::Resource::ChefHandler) directly is no longer supported in Chef 13 and will be removed.  Use Chef::Resource.resource_for_node(node, name) instead.

 

Where is the documentation to explain how to do this? IOW, how would the chef_handler resource call change? What do I put in ‘node’ and ‘name’

 

Chef_handler ‘Chef::Resource.resource_for_node(node, name)’ do

  source "/tmp/some_handler.rb"

  supports :report => true

  action :enable

end

 

 

 

Chris

 

Nathan Williams | 26 Jun 22:13 2015
Picon

haproxy-ng 1.0.0 released!

Ohai Chefs!

After 6 months of successfully using it in production, and some major
refactoring and code cleanup over the last few releases, I've decided
I'm comfortable enough with the state of things to release 1.0.0 of the
haproxy-ng cookbook [1].

If you've been holding off for things to settle down a bit, that moment
has come, and I officially promise not to pull the rug out from under
you :)

As always, feedback is welcome, so if you run into any problems or have
any questions/requests, please feel free to open an issue, and I'll do
my best to respond in a reasonable timeframe.

Regards,

Nathan W

[1]: https://supermarket.chef.io/cookbooks/haproxy-ng 


Gmane