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.