Hi, I'm trying to create a squid url_regex ACL source file for various different sites. Each site needs a slightly different configuration, so my plan was to create the a bunch of files on the server, then drag them down and concatenate them into a single file on the client.
I found http://reductivelabs.com/trac/puppet/wiki/CompleteConfiguration and i've been trying to understand its approach to constructing a file out of fragments. Am i right in thinking that i need to distribute an entire directory from the server, then use concatenated_file to combine those files into one file on the puppet agent? I'd rather not distribute the entire directory from the server, since it contains custom content for each node. Is there a way i can do this with templates that include other files? (Or templates that are plain text rather than .erb?) I'd really like to find a technique that doesn't require separately copying the file fragments to the client also... I've had 3 or 4 tries at getting the right approach and am still no closer to a working solution. Attached is my non-working attempt at a class to do this - what am i doing wrong? (Comments about what's not working can be found after the @@@ comments.) I thought this was a fairly simple problem, but i've been banging my head against it all day without any success. Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@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 -~----------~----~----~----~------~----~------~--~---
# # puppet class to distribute a copy of squid's url_regex acl file nopasswordsites.txt. # class squid { # ensure package is installed package { "squid": ensure => installed } # create a directory for storing the parts $basedir = "/etc/squid/nopasswordsites.d" file { $basedir: ensure => directory, owner => root, group => root, mode => 755, } # these are the files that should be in the directory $squid_nopassword_files = [ "HEADER", "$hostname.permanent", "$hostname.temporary", "ISP.$isp", "FOOTER", ] # @@@ We need another copy of the file names that's fully qualified because # @@@ there's no basename function which can be used in the source specification # @@@ in squid_nopassword_file above, and the content parameter on the file # @@@ resource below needs a fully-qualified file name. $squid_nopassword_files_fully_qualified = [ "$basedir/HEADER", "$basedir/$hostname.permanent", "$basedir/$hostname.temporary", "$basedir/ISP.$isp", "$basedir/FOOTER", ] define squid_nopassword_file () { file { "$basedir/$name": owner => root, group => root, mode => 644, path => "$basedir/$name", source => "puppet:///squid/nopasswordsites/$name", } } # realise each of the files # @@@ We seem to need to use a function for this rather than just using # @@@ file { $squid_nopassword_files: ... } because in the current scope # @@@ $name is the name of the class (squid), not the name of the file resource. squid_nopassword_file { $squid_nopassword_files: } # concatenate all those files into our target file # @@@ This doesn't work! It gives the error: "err: Could not retrieve catalog: # @@@ Files must be fully qualified at /etc/puppet/modules/squid/manifests/init.pp:39" # @@@ This occurs regardless of whether the $squid_nopassword_files or # @@@ $squid_nopassword_files_fully_qualified file { "/etc/squid/nopasswordsites.tmp": owner => root, group => root, mode => 644, content => file($squid_nopassword_files_fully_qualified), } }