Ask Your Question
0

Create an array from a file?

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

lgj42 gravatar image

Hello!

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

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-04-19 19:45:55 -0600

solarkennedy gravatar image

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 }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-02-11 15:40:54 -0600

Seen: 435 times

Last updated: Feb 11 '14