Create an array from a file?

asked 2014-02-11 15:40:54 -0500

lgj42 gravatar image


So I need to create some file resources based on files that are listed in a conf file (particularly /etc/rsyslog.conf). Using regex, I can get the log files listed in rsyslog.conf into another file, where each line has one log file path listed. I need for puppet to be able to read that file and turn each line into a file resource.

I've tried writing a function, but afterward I read that functions are executed server-side, so not to write it where it needs node-specific information.

Any suggestions are greatly appreciated!

edit retag flag offensive close merge delete


This would be very simple if the rsyslog.conf was *controlled* by puppet, is that the case? The only other way to get data out of a *client* is by custom facts. You could write a custom fact based on your regex and make that available to your puppet manifests. Like: $file_array = split($::rsyslog_logfiles, ',') file { $file_array: ensure => file }

solarkennedy gravatar imagesolarkennedy ( 2014-04-19 19:45:55 -0500 )edit