Created
June 11, 2013 11:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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