Tag Archives: Ruby

chef attribute : avoiding “undefined method `[]’ for nil:NilClass” error

In chef, when a nested attribute that might not exist/or not crated yet, you can use rescue as a modifier to an if statement. For example, assuming that only some of your nodes have node[‘install_wls’][‘isManaged’]defined: if node[‘install_wls’][‘isManaged’] do the stuff … Continue reading

Posted in ARTICLES, Configurtion management, DevOps, HOWTO | Tagged , , , , | Leave a comment

chef knife tricks: Add a node in an environment

  Sometime during automation of a large deployment process, we have to bootstrap a node , create environment and add the node in that particular environment on the fly.   Bootstraping : 2. Create environment dynamically from inside the programme:(python … Continue reading

Posted in ARTICLES, Configurtion management, DevOps, HOWTO, Programming | Tagged , , , | Leave a comment

Chef – Create encrypted data bag and keep secrets

Sometimes we have to deal with global variables like User passwords, database password, API Keys, middleware boot properties in our chef recipes which shouldn’t be exposed outside. One solution is we have to keep all the secrets in a data … Continue reading

Posted in ARTICLES, DevOps, HOWTO, OperatingSystem, Programming, SCRIPTING | Tagged , , , , | 1 Comment

Writing chef Library

In many cases we have to reuse same code again and again in our recipes. So to reduce this we can write our own library module and reuse it’s methods whenever required. This can help us use our own custom … Continue reading

Posted in ARTICLES, DevOps, HOWTO, Programming, SCRIPTING, TIPS & T RICS, TUTORIALS | Tagged , , , , , , | Leave a comment

Chef/ruby way – Read a file and expose as environment variable

Many time we have to read a property file in in which the variable and value are comma separated and we have to set those in our environment variable to execute certain recipes.   e.g. property file (/u01/data/wor/app/conf/conf.prop) ops_home = … Continue reading

Posted in ARTICLES, DevOps, HOWTO, Programming, TUTORIALS, Uncategorized | Tagged , , , , , | Leave a comment