I am pretty new to Chef. I wanted to install Java on my Chef Nodes through recipes. This is what I tried:
default.rb looks like this:
root@user:/chef-repo/cookbooks/java/recipes#cat default.rb
#
# Cookbook Name:: java
# Recipe:: default
#
# Copyright 2016, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "java"
metadata.rb looks like this:
root@user:~/chef-repo/cookbooks/java# cat metadata.rb
name 'java'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures java'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends "java", "~> 1.39.0"
And then I upload this cookbook by the following command:
root@user:~/chef-repo/cookbooks/java/recipes# knife cookbook upload java
WARN: Ignoring self-dependency in cookbook java, please remove it (in the future this will be fatal).
Uploading java [0.1.0]
Uploaded 1 cookbook.
Then I log into my Chef-client node and execute this recipe:
root@client:/usr/share/java# sudo chef-client
Starting Chef Client, version 12.11.18
resolving cookbooks for run list: ["java"]
Synchronizing Cookbooks:
- java (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 0 resources
Running handlers:
Running handlers complete
Chef Client finished, 0/0 resources updated in 02 seconds
It looks like this has not installed anything. I try and check java version and I get nothing.
root@client:~# java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: apt-get install <selected package>
Can someone please let me know what am I missing here?