Detect when files are put in a directory? And alternatives?

33 views
Skip to first unread message

Shark Laser

unread,
Jan 2, 2014, 6:39:31 PM1/2/14
to puppet...@googlegroups.com

I'm a puppet newbie but have gone through the tutorial and now read most of a book on the subject.    (So please tell me if I am approaching the problem wrong conceptually).

Problem:   We want a directory where any user can put a file which will signify a program that is to be installed by Puppet.   i.e.  If one were to go to this special location and do 'touch someSpecialCompileOfApache' then Puppet would see the new file in the directory and we would have additional logic to then install a special compile of apache.  (just a simple contrived example)

The first hurdle seems to be that 'notify' s don't get triggered on a directory if files are merely put in the directory.    Are my findings here correct?   It seems the directory itself would have to change to trigger the notify?  ie the name of the directory or a permission?  That seems to nix the first attempt.

Assuming I am right so far,   I thought of a second possibly simpler approach.   I wanted to have one text file.    Each line in the text file would contain an entry for a program that was to be installed.   I'm sure I can get notify's when the single file is changed.   Is puppet sophisticated enough that I could see what the change was in the text file and then determine an action based on that? 

Thanks in advance.

Peter Bukowinski

unread,
Jan 2, 2014, 8:49:45 PM1/2/14
to puppet...@googlegroups.com, puppet...@googlegroups.com
This is antithetical to the way Puppet is normally used, but what you're asking for is possible if you look for custom facts in /etc/facter/facts.d and use them as triggers for specific software installs. Basically, you can create one or more .txt files in that location containing one or more 'key=value' pairs, then use those fact values with a selector to, for example, have puppet install a specific apache build.

See the puppet docs for specifics:

http://docs.puppetlabs.com/guides/custom_facts.html#external-facts

Note that I'm not condoning this particular use of puppet, just saying that it's possible.

-- Peter Bukowinski
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/7f71bfe0-2310-474b-a55e-f3bf9bfc3bf8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages