Skip to content

Instantly share code, notes, and snippets.

@stack72
Created June 11, 2013 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stack72/5756142 to your computer and use it in GitHub Desktop.
Save stack72/5756142 to your computer and use it in GitHub Desktop.
Manifest that will use PowerShell and MSIExec to install 7zip on a windows server. It will decide what version of the file to use due to $::architecture which is part of facter
class application_7zip {
case $::architecture {
'x64': {
$file_name = '7z922-x64.msi'
$exe_filepath = 'C:\Program Files\7-Zip\7z.exe'
}
'x86', default: {
$file_name = '7z922.msi'
$exe_filepath = 'C:\Program Files (x86)\7-Zip\7z.exe'
}
}
file { '7zip-msi':
ensure => file,
mode => '0777',
path => "C:\\PuppetScripts\\${file_name}",
source => "puppet:///modules/application_7zip/${file_name}",
require => File['C:\PuppetScripts'],
}
exec { 'install-7zip':
creates => $exe_filepath,
path => "C:\Windows\sysnative\WindowsPowershell\v1.0;C:\\Windows\\sysnative;${::path}",
command => "powershell.exe -ExecutionPolicy RemoteSigned -Command \"msiexec.exe /i C:\\PuppetScripts\\${file_name} /passive /quiet\"",
logoutput => true,
require => File['7zip-msi']
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment