Hi all I have a thorny problem I can't work out a way to Puppet around. Caution: long, confusing, probably badly-explained.
We use Autonomy IDOL 7, which I've packaged into an RPM that installs in /opt/idol7/shared. This is a generic install -- to actually configure an IDOL server we set up /opt/idol7/Instance, which contains a configuration file and symlinks to the shared binary and other resources. E.g.: [r...@dev ~]# ls -l /opt/idol7/Intranet [..] -rw-r--r-- 1 idol idol 13277 Dec 9 13:04 IntranetIDOLServer.cfg lrwxrwxrwx 1 idol idol 52 Aug 21 09:19 IntranetIDOLServer.exe - > /opt/idol7/shared/content/content.exe lrwxrwxrwx 1 idol idol 42 Aug 21 09:19 langfiles -> /opt/idol7/ shared/langfiles lrwxrwxrwx 1 idol idol 55 Aug 21 09:19 libautnxslt.so -> /opt/ idol7/shared/content/libautnxslt.so lrwxrwxrwx 1 idol idol 40 Aug 21 09:19 modules -> /opt/idol7/ shared/modules lrwxrwxrwx 1 idol idol 42 Aug 21 09:19 templates -> /opt/idol7/ shared/templates Most of these symlinks are set up by the in-house init script we use. The only things that are actually needed are the configuration file and binary symlink, so: class autonomy::idol7 inherits autonomy { define instance() { file { "/opt/idol7/$title": ensure => directory, owner => "idol", group => "idol", require => Package["IDOL7"]; "/opt/idol7/$title/${title}IDOLServer.cfg": ensure => present, owner => "idol", group => "idol", notify => Service["${title}IDOL7Server"], source => "puppet://$servername/autonomy/idol7/${title} IDOLServer.cfg"; "/etc/init.d/${title}IDOL7Server": ensure => present, mode => 755, content => template("autonomy/idol7/init.sh.erb"); } service { "${title}IDOL7Server": # links to in-house init script } } node foo { autonomy::idol7::instance { "Intranet": } } The first time the service is started the rest of the symlinks are created. But! Now and then I need to override some files in langfiles. If this is necessary we'd remove the symlinked-to-shared langfiles, copy the shared langfiles directory into the Instance directory and replace the appropriate files. E.g.: * rm /opt/idol7/Instance/langfiles * cp -prv /opt/idol7/shared/langfiles /opt/idol7/Instance * cp /file/store/foo.dat /opt/idol7/Instance/langfiles I'd rather get Puppet to do this. Ideally I'd do: node foo { autonomy::idol7::instance { "Intranet": "langfiles" => "override" } } And have my define() remove the symlink, copy the shared files over and then copy the contents of "puppet://$servername/autonomy/idol7/$ {title}/langfiles" into /opt/idol7/${title}/langfiles. Implementing this is where I fall down. At the moment all I can think of is something like: define instance($langfiles = "") { [..] case $langfiles ? { "": { file { # make symlink to shared } }, default: { exec { "idol7_copy_langfiles": # remove symlink, copy shared langfiles } file { "/opt/idol7/${title}/langfiles": ensure => directory, source => "puppet://$servername/autonomy/idol7/${title}/ langfiles", require => Exec["idol7_copy_langfiles"] } } } } This is a bit nasty -- I'd need to figure out a way to make the exec only run once or each Puppet run will clobber my overridden files and then replace them again. If I do work out how to make it only run once Puppet won't update the instances if the contents of the shared directory change, or if I fat-fingeredly remove a non-managed file from /opt/idol7/Instance/langfiles. So, any ideas? How can I do this cleanly? And thanks for reading this far! Cheers, Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---