«

»

Nov 19

Chef change attributes node level Java cookbook

How do you change the attributes at the node level.  I just went through this recently with some Scala servers that required Oracle Java 7.  The defaults for the Java cookbook at the marketplace: https://supermarket.getchef.com/cookbooks/java#readme are openJDK 6.  To replace them you need to:

knife node edit <NODE_NAME>

In the editor that pops up add the java section under normal.  In the precidence order normal will overwrite the attributes in the java file.

{
"name": "AWSSERVER-UE1T",
"chef_environment": "TEST",
"normal": {
"java": {
"install_flavor": "oracle",
"jdk_version": "7",
"oracle": {
"accept_oracle_download_terms": true
}
},
"set_fqdn": "AWSSERVER-UE1T.aws.test.local",
"agency": "VIV",
"tags": [

]
},
"run_list": [
"role[linux_base]",
"recipe[ubuntu_xfce_rdp]",
"recipe[scala]"
]
}

Now with that said after running chef-client locally on the server it didn’t pickup the changes.  But you will see the change in the json attributes on the chef server.

Amazon has a good atricle on overriding attributes here: http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json-override.html

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Close Bitnami banner
Bitnami