How to discriminate between multiple directories in files/?


#1

I’m working on a special MongoDB recipe that has

files
     default
         mongodb
             arbiter
                 log
             configsvr
                 log
             sharding
                 log
             bin

and I have recipes /default.rb/, /arbiter.rb/, /configsvr.rb/,
/sharding.rb/, /replica.rb/.

/default.rb/ is run no matter what to install basic MongoDB on any
database node. Then, depending on the node’s function, another recipe is
run.

I think I want to use…

remote_directory"/data/mongodb" do
     source "mongodb"
     etc.
end

…in the default recipe, but I don’t ever want the default recipe to
create the additional, irrelevant directory structure for arbiter,
configuration server, sharding router, etc. on every node. The
respective recipes, if run, will take care of that.

Opcode’s remote_directory documentation speaks only of sources under
default, which implies that while, for the /configsvr.rb/ I could do…

remote_directory "/data/mongodb/configsvr" do
     source "mongodb/configsvr"
end

…and expect the additional structure to be added, it’s not clear to me
how to avoid extra structure in /default.rb/. Or do I need to resort to
a separate cookbook for my basic default MongoDB installation? Other
MongoDB cookbooks I see appear to be adding a bunch of subdirectory
structure even when not needed.

I’m still very new at this and my view of the problem may be completely
twisted.

Many thanks and best regards,

Russ


#2

In default.rb could you just do something like this?

directory “/data/mongodb” do
action :create
etc…
end
remote_directory “/data/mongodb/bin” do
source "mongodb/bin"
etc.
end

On Fri, Aug 30, 2013 at 7:42 PM, Russell Bateman russ@windofkeltia.comwrote:

I’m working on a special MongoDB recipe that has

files
default
mongodb
arbiter
log
configsvr
log
sharding
log
bin

and I have recipes default.rb, arbiter.rb, configsvr.rb, *
sharding.rb*, replica.rb.

default.rb is run no matter what to install basic MongoDB on any
database node. Then, depending on the node’s function, another recipe is
run.

I think I want to use…

remote_directory “/data/mongodb” do
source "mongodb"
etc.
end

…in the default recipe, but I don’t ever want the default recipe to
create the additional, irrelevant directory structure for arbiter,
configuration server, sharding router, etc. on every node. The respective
recipes, if run, will take care of that.

Opcode’s remote_directory documentation speaks only of sources under
default, which implies that while, for the configsvr.rb I could do…

remote_directory “/data/mongodb/configsvr” do
source "mongodb/configsvr"
end

…and expect the additional structure to be added, it’s not clear to me
how to avoid extra structure in default.rb. Or do I need to resort to a
separate cookbook for my basic default MongoDB installation? Other MongoDB
cookbooks I see appear to be adding a bunch of subdirectory structure even
when not needed.

I’m still very new at this and my view of the problem may be completely
twisted.

Many thanks and best regards,

Russ


#3

Oh, yes, of course. I will try this. I’ve mostly been looking at other
recipes for inspiration and none of them use directory, so I wasn’t
thinking about this problem in as simple a way as I should have. I’ve
begged my company for the two-day Chef training, but they say this
year’s travel budgets are shot. So my Chef tutors have been existing
recipes, Google and this forum (but, it takes me a while to figure out
enough about my problem to explain it before posting here).

Thank you very much,

Russ

On 08/30/2013 10:16 PM, David Petzel wrote:

In default.rb could you just do something like this?

directory “/data/mongodb” do
action :create
etc…
end
remote_directory “/data/mongodb/bin” do
source "mongodb/bin"
etc.
end

On Fri, Aug 30, 2013 at 7:42 PM, Russell Bateman
<russ@windofkeltia.com mailto:russ@windofkeltia.com> wrote:

I'm working on a special MongoDB recipe that has

    files
        default
            mongodb
                arbiter
                    log
                configsvr
                    log
                sharding
                    log
                bin


and I have recipes /default.rb/, /arbiter.rb/, /configsvr.rb/,
/sharding.rb/, /replica.rb/.

/default.rb/ is run no matter what to install basic MongoDB on any
database node. Then, depending on the node's function, another
recipe is run.

I think I want to use...

    remote_directory"/data/mongodb" do
        source "mongodb"
        etc.
    end

...in the default recipe, but I don't ever want the default recipe
to create the additional, irrelevant directory structure for
arbiter, configuration server, sharding router, etc. on every
node. The respective recipes, if run, will take care of that.

Opcode's remote_directory documentation speaks only of sources
under default, which implies that while, for the /configsvr.rb/ I
could do...

    remote_directory "/data/mongodb/configsvr" do
        source "mongodb/configsvr"
    end

...and expect the additional structure to be added, it's not clear
to me how to avoid extra structure in /default.rb/. Or do I need
to resort to a separate cookbook for my basic default MongoDB
installation? Other MongoDB cookbooks I see appear to be adding a
bunch of subdirectory structure even when not needed.

I'm still very new at this and my view of the problem may be
completely twisted.

Many thanks and best regards,

Russ