Jistanidiot
Jistanidiot

Reputation: 56676

Puppet how to run all manifests in directory

So I have a directory of puppet manifests that I want to run.

Is it possible to do something like: include /etc/puppet/users/server522/*.pp and have puppet run them?

I've tried include users::server522::* and several other variations

I always get an error about puppet being unable to find it.

Is there anyway to do this?

Upvotes: 2

Views: 2326

Answers (3)

smentek
smentek

Reputation: 2884

I do not see the point of each user having its own manifest. I would rather create script that would automatically build one manifest file, basing on data from some source, for instance from HEAD of git repository containing CSV file with current list of users.

If you realy want to use separate manifest file for every user you may consider having seprate module for every user:

manifests
  default.pp <-- here comes default manifest
  module_for_user_foo/
    manifests/
      init.pp <-- here comes your 'foo' user
  module_for_user_bar/
    manifests/
      init.pp <-- here comes your 'bar' user

Now you may copy modules containing manifests.

Upvotes: 0

Jistanidiot
Jistanidiot

Reputation: 56676

So my final solution to this was write a script that would take the directory listing and for each .pp file add an include into the server522.pp file. Quite annoying that puppet won't include an entire directory.

Upvotes: 1

Forest
Forest

Reputation: 828

What are you trying to do here, and are you sure you're doing it the correct way? To wit, if you have multiple manifests corresponding to multiple servers, you need to define the nodes for each server. If OTOH you're trying to apply multiple manifests to a single node it's not clear why you would be doing that, instead of just using your defined classes. A little more information would be helpful here.

Upvotes: 0

Related Questions