File resource management with chef


#1

I’m new to chef and trying to understand how files are managed in cookbooks.

The problem I’m trying to solve is how to dynamically move a process (and it’s associated data files) from one box to another.

I have a scenario where I have 2 cookbooks that manage 2 separate processes (lets say CB-A and CB-B). CB-B has a data file associated with it that is deployed from the cookbook. However, once deployed the data file can be updated. I was thinking of using the Chef API to dynamically move CB-B from one node to another, but how to move the associated data file? Do I need to somehow sync the updated file back to the cookbook before moving the cookbook to another node?, or is that done automatically?

Or is there an easier way to do this?

Thanks for any help.
Joe


#2

IMHO you shouldn’t be keeping dynamically updated files in Chef cookbooks -
it’s just not the easiest place to have these files in. As far as moving
these files around, you could have an “install script” in CB-B that copies
the file from CB-A’s host (the hostname would be determined through Chef
search).

On Mon, Jun 2, 2014 at 7:45 AM, Joe Becknell jbecknell@4qbase.com wrote:

I’m new to chef and trying to understand how files are managed in
cookbooks.

The problem I’m trying to solve is how to dynamically move a process (and
it’s associated data files) from one box to another.

I have a scenario where I have 2 cookbooks that manage 2 separate
processes (lets say CB-A and CB-B). CB-B has a data file associated with it
that is deployed from the cookbook. However, once deployed the data file
can be updated. I was thinking of using the Chef API to dynamically move
CB-B from one node to another, but how to move the associated data file? Do
I need to somehow sync the updated file back to the cookbook before moving
the cookbook to another node?, or is that done automatically?

Or is there an easier way to do this?

Thanks for any help.

Joe


Best regards, Dmitriy V.