简体   繁体   中英

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?

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM