[chef] What can be used in not_if / how to build something that can be used?


Chronological Thread 
  • From: Norbert Hartl < >
  • To:
  • Subject: [chef] What can be used in not_if / how to build something that can be used?
  • Date: Wed, 21 Sep 2011 14:11:52 +0200

Hi,

this is my first post and I'm learning chef at the moment. I'm using veewee, 
vagrant and chef to bootstrap an appliance for me. The basic machine is 
bootstrapped and running. Nice tool you did :)

Now I try to integrate the stuff a little bit more and make it more reliable. 
One of the things I do is to check condition that decide if a action needs to 
take place or not. In the tutorials/examples this almost all the time done 
using something like "unless File.exists....". I need to do something similar 
but for another running component. The task is to load some code into server. 
In order not to load the code every single provisioning time I like to check 
if it has been loaded already. I know how to do it with 
execute/script/bash... but then I have to write the specific action it has to 
do (that follows the condition) within the action. But I need the capabiltiy 
of checking things in the server quite often. So I'm looking for slightly 
more generic way of achieving it.
I don't know if it is possible to create a definition function, an action or 
anything that returns a value and therefor can be used in not_if, only_if, 
etc. I had the impression LWRP could help but know I don't know how. My last 
ressort seems to be writing a library that I include in a recipe. But I 
wanted to ask if there is a better possibility to achieve the same. 

I hope I could explain my problem in a proper way. I'm not used to chef 
terminology, yet. Sorry for that.

thanks in advance,

Norbert




Archive powered by MHonArc 2.6.16.

§