I posted about this yesterday, I’m going to post again - but this time with links to code.Here is the code:
My goal is to be able to install java, oracle DB, jenkins server, install jenkins slaves, create jobs, update jobs with Chef Solo on a system of 15 servers. 1 server will be the jenkins master and the other 14 will be slaves.I’m starting my recipe with java and jenkins installs.
I’m guessing I’m doing several things wrong:I ended up configuring the java attributes in nodes/redstone.json as I couldn’t get them to work inside my recipe. It seems to me it would be better to do this in my recipe as this will not be node specific, I want it global.Here is what happens with the current code (even with include_recipe "java::default”as suggested by Christopher Armstrong)Any help, suggestions, critiques would be greatly appreciated. Links to real-life projects would be great, almost everything I see is completely trivial or just doc on attributes for recipes. I’d love to see a real life project I could download and execute.
here is the output for running the current code::~/dev/chef/myfirstcookbook (master)$ knife solo cookWARNING: solo.rb found, but since knife-solo v0.3.0 it is not used any moreWARNING: Please read the upgrade instructions: https://github.com/matschaffer/knife-solo/wiki/Upgrading-to-0.3.0Running Chef on redstone...Checking Chef version...Installing Berkshelf cookbooks to '/Users/philswenson/.berkshelf/knife-solo/35c024dd80a9ab482eadf86b98a86fb90c9521d7'...Using myfirstcookbook (0.1.0)Using jenkins (2.0.2)Using git (3.1.0)Using java (1.20.0)Using apt (2.3.8)Using runit (1.5.10)Using build-essential (2.0.0)Using yum (3.1.4)Using yum-epel (0.3.4)Using dmg (2.2.0)Using windows (1.30.0)Using chef_handler (1.1.5)Uploading the kitchen...cannot delete non-empty directory: mainWARNING: Local role_path './roles' does not existWARNING: Local data_bag_path './data_bags' does not existWARNING: Local environment_path './environments' does not existGenerating solo config...Running Chef...Starting Chef Client, version 11.10.4[2014-03-14T19:07:47-04:00] WARN: unable to detect ip6addressCompiling Cookbooks...HI PHIL HI PHIL================================================================================Recipe Compile Error in /root/chef-solo/cookbooks-3/main/recipes/default.rb================================================================================NoMethodError-------------undefined method `[]' for nil:NilClassCookbook Trace:---------------/root/chef-solo/cookbooks-2/java/recipes/oracle.rb:38:in `from_file'/root/chef-solo/cookbooks-2/java/recipes/default.rb:22:in `from_file'/root/chef-solo/cookbooks-3/main/recipes/default.rb:8:in `from_file'Relevant File Content:----------------------/root/chef-solo/cookbooks-2/java/recipes/oracle.rb:31:32: case node['java']['jdk_version'].to_s33: when "6"34: tarball_url = node['java']['jdk']['6'][arch]['url']35: tarball_checksum = node['java']['jdk']['6'][arch]['checksum']36: bin_cmds = node['java']['jdk']['6']['bin_cmds']37: when "7"38>> tarball_url = node['java']['jdk']['7'][arch]['url']39: tarball_checksum = node['java']['jdk']['7'][arch]['checksum']40: bin_cmds = node['java']['jdk']['7']['bin_cmds']41: end42:43: if tarball_url =~ /example.com/44: Chef::Application.fatal!("You must change the download link to your private repository. You can no longer download java directly from http://download.oracle.com without a web broswer")45: end46:47: include_recipe "java::set_java_home"
Archive powered by MHonArc 2.6.16.