Skip to content

Instantly share code, notes, and snippets.

@smerchek
Last active October 17, 2016 13:29
Show Gist options
  • Save smerchek/5868767 to your computer and use it in GitHub Desktop.
Save smerchek/5868767 to your computer and use it in GitHub Desktop.
Puppet for windows installers at Softek
# This is the basic structure for a Windows project puppet module at Softek
# We found that the Package type as provided by Puppet was not quite sufficient for our needs.
# Instead, we transfer the file, exec msiexec when it changes (while logging install output), and then ensure the service is running.
class some_project {
$installer = 'Project.Setup.msi'
$url = "puppet:///release/${installer}"
file { "c:/packages/${installer}":
ensure => 'file',
mode => '1777',
owner => 'administrator',
group => 'Administrators',
source => $url,
}
exec { 'Package Project':
path => "c:\\windows\\system32",
command => "msiexec /qn /norestart /i c:\\packages\\${installer} /l*v c:\\packages\\${installer}.log",
refreshonly => true,
subscribe => File["c:/packages/${installer}"],
require => [
Class['other_project'],
Class['another_project'],
],
}
service { 'project.service':
ensure => running,
require => Exec['Package Project'],
subscribe => [
Env['PROJECT_CONFIGURATION'], # custom Env type for defining environment variables
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment