Hello, for a an individual config file you can :
1° delete the file unless there is a special tag line in it 2° then ensure the file with replace = false Example here : https://github.com/lofic/puppet-jboss7/blob/master/templates/domain.xml.jboss-as-7.1.1#L35 https://github.com/lofic/puppet-jboss7/blob/master/manifests/init.pp#L99-L104 https://github.com/lofic/puppet-jboss7/blob/master/manifests/domain.pp#L47-L56 Louis 2014-01-31 jcbollinger <[email protected]>: > > > On Thursday, January 30, 2014 10:22:59 AM UTC-6, [email protected] wrote: >> >> Hi, >> >> I am trying to install Apache with a default set of config files. I have >> the following class: >> >> class base_apache { >> >> case $operatingsystem { >> windows: { >> file { 'apache_installer_package': >> path => 'D:/Downloads/Puppet/', >> ensure => directory, >> source => 'puppet:///files/Apache-Installers/', >> recurse => true, >> purge => false, >> source_permissions => ignore, >> replace => no, >> before => Package['Apache HTTP Server 2.2.25'] >> } >> >> package { 'Apache HTTP Server 2.2.25': >> ensure => installed, >> source => 'D:\\Downloads\\Puppet\\httpd- >> 2.2.25-win32-x86-openssl-0.9.8y.msi', >> install_options => {'INSTALLDIR' => >> 'D:\Apache2.2','SERVICENAME' => 'Apache.2.2','ALLUSERS' => 1}, >> before => File['default_apache_config'] >> } >> >> file { 'default_apache_config': >> path => "D:/Apache2.2/conf", >> ensure => directory, >> source => 'puppet:///files/Apache2.2/conf', >> recurse => true, >> purge => true, >> source_permissions => ignore, >> replace => yes, >> } >> } >> } >> } >> >> As you can see, I am installing Apache using MSI package and then copying >> over the default set of configs. This works, however.... If I make a >> modification to the config files, Puppet will notice that it has changed >> and overwrite it on the next run. >> >> What I want it to do if copy the files ONLY IF the "package" directive >> had to install Apache. If it already existed on the server and it didn't do >> anything, don't do the File['default_apache_config'] bit... I could set >> replace => no but then it wouldn't work on the first one run either as the >> installer creates its own default set of configs. >> >> Is this possible or do I have to be a bit cleverer than that? >> >> > > Puppet manifests do not model processes, they model target state. > Generally speaking, therefore, you cannot easily tell Puppet to perform > some action only if it has done / plans to do some other action -- actions > are not a subject that can even be expressed in the DSL. > > Puppet does have the concept of 'refreshing' a resource when another has > been modified in the same run, but only in the case of Execs is that paired > with the possibility of not managing the resource under other circumstances. > > You could consider building a custom Apache installer package that has > your desired starting configs already baked in. Or perhaps you could put > the alternative configs in their own installer, and manage them as a > Package. > > > John > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/ab072a71-6f47-4418-8216-402ab0fda4a3%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAE9jN30JUDO5p9-zdFD_Wx0dBupdAORWWD%2BV7F-JPmsMgOm2%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
