On 11/14/2012 08:48 PM, Bernardo Costa wrote: > Well, what I could understand from your proposition (1) is that I should > elect one of the hosts as representative of a group of hosts and make > all other hosts inherit its configuration like the example I am showing > below. > > class automount { > file { "/var/tmp/auto.direct": > source =>"puppet:///files/automount/${hostname}.conf", > } > } > > node default { > include automount > } > > node itchy1, itchy2, itchy3 inherits default { > file { "/var/tmp/auto.direct": > source =>"puppet:///files/automount/itchy.conf", > } > } > > What I'd like to avoid using this scheme of concatenating templates is > changing many files when only one entry is changed. Supposing many hosts > mount a specific directory, if the provider file of this directory > changes, then I'd need to use a sed script to change only one entry. In > fact, this is a complex issue. Maybe the best thing is not putting every > direct mountpoints in only one map/file but splitting them in maybe two, > three or four. For this, I'd need a auto.master file like the one below. > > /- /etc/auto1.direct > /- /etc/auto2.direct > /- /etc/auto3.direct > /- /etc/auto4.direct > > Your idea of defining a basic map and just override the basic if a > particular map exists with the name of the host is interesting but for > my case, I'd need almost one particular map for each host. Most of the > hosts have particular direct mountpoints. Although this is a fairly > complex thing to configure in all hosts, I am trying to find the most > simple and elegant solution :) For now, I am trying to avoid using > concat module as I prefer to have the bare minimum of puppet features > and not many dependences on external tools. Anyway, thank you for you help.
If I understood you correctly, you have some standard blocks that need to be present on most of the hosts, but almost every host has different final concatenated configuration file? For example, you have blocks: block1 block2 block3 block4 host1block1 host1block2 host2block1 host3block1 You could name the files something like that on the master, and then use generate() in your manifest. You would pass $::fqdn to generate script, which runs on master, takes all of the blocks and builds final file which will be shipped to a node. For example: if generate('/etc/puppet/modules/costa/scripts/generate_file.sh',$::fqdn) { file {'/var/tmp/auto.direct': source => "puppet:///files/${::fqdn}/auto.direct", } } generate_file.sh script could look something like this: #!/bin/bash # standard for all hosts: cat block1 >> /etc/puppet/files/$HOSTNAME/auto.direct cat block2 >> /etc/puppet/files/$HOSTNAME/auto.direct cat block3 >> /etc/puppet/files/$HOSTNAME/auto.direct cat block4 >> /etc/puppet/files/$HOSTNAME/auto.direct HOSTNAME="$1" for i in `ls /etc/puppet/modules/costa/files/fragments | grep $HOSTNAME`; do cat $i >> /etc/puppet/files/$HOSTNAME/auto.direct done If that solution is not good for your particular case, I suggest you rewrite automount startup script, so that on each (re)start and refresh it removes automount.conf and concatenates all files from "automount.d" into new config file. That way your puppet manifest would be really clean and readable, and you would only push building blocks as files and not the finished configuration file. That kind of solution Samba developers suggest to those who dare to ask when and if they will develop/implement "samba.d" behaviour :) -- 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.