Created
May 17, 2013 11:24
-
-
Save stack72/5598480 to your computer and use it in GitHub Desktop.
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
We have the following in /modules/manage_windows_feature/manifests.init.pp | |
define manage_windows_feature($feature_name = $title) { | |
$powershell_cmd = "powershell.exe" | |
$exec_policy = "-executionpolicy remotesigned" | |
exec { "install-feature-${feature_name}" : | |
command => "$powershell_cmd ${exec_policy} -Command \"Import-Module ServerManager; Add-WindowsFeature ${feature_name}\"", | |
path => "C:\\Windows\\sysnative\\WindowsPowershell\\v1.0;${::path}", | |
onlyif => "${powershell_cmd} ${exec_policy} -Command \"Import-Module ServerManager; if((Get-WindowsFeature ${feature_name}).Installed) { exit 1 }\"", | |
logoutput => true, | |
} | |
} | |
This is used across a number of our modules and called from within a module (/modules/windowsfeatures_iis_application_development/manifests/init.pp) and it looks as follows: | |
class windowsfeatures_iis_application_development { | |
manage_windows_feature { 'Web-Asp-Net': } | |
manage_windows_feature { 'Web-Net-Ext': } | |
manage_windows_feature { 'Web-ISAPI-Ext': } | |
manage_windows_feature { 'Web-ISAPI-Filter': } | |
} | |
this manage_windows_feature is used across a number of classes. Therefore, where is the best place to keep it? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly where you've got it - in it's own module.