I have a situation where I am trying to manage some systems that have a single IP address but different ssh port numbers. For each of these systems I need to individually manage a logrotate.d configuration file, and a separate archive directory.
Of course, this won't work... file { "/data/syslog/${remote_host}/archive": ensure => directory; "/etc/logrotate.d/syslogng-host-${remote_host}": content => template("syslog-ng/etc/logrotate.d/server.erb"); } Puppet complains for the first entry that the file is not unique, since I am trying to call it multiple times with the same $remote_host. If the directory already exists, that's great. How can I make puppet skip it in that case? The puppet docs at http://docs.reductivelabs.com/references/stable/function.html state that there is an "if defined" function, but I've never gotten this to work, and the documentation really isn't very clear as to if functions are supposed to work inside a manifest. I tried this: file { if ! defined(File["/data/syslog/${remote_host}/archive"]) { "/data/syslog/${remote_host}/archive": ensure => directory; } } and this: if ! defined(File["/data/syslog/${remote_host}/archive"]) { file { "/data/syslog/${remote_host}/archive": ensure => directory; } } .... both of which resulted in errors. As I said, the documentation really isn't clear if functions CAN be used inside a manifest. That has always confused me and I wish someone would clear up the docs. For the second entry, I can simply make it unique by suffixing the unique ssh port number. That's not an option for the first file though. Doug -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.