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
# install puppet | |
$msiArgumentList = "/qn /i C:\FolderName\puppet-enterprise-3.2.0.msi /l*v C:\install_puppet.log" | |
Start-Process -FilePath msiexec.exe -ArgumentList $msiArgumentList -Wait | |
# add puppet to path | |
$SetPath = $env:Path + ";C:\Program Files (x86)\Puppet Labs\Puppet Enterprise\bin\" | |
[Environment]::SetEnvironmentVariable("Path", "$SetPath", "Machine") | |
# Reload path ( in order to install modules ) | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") |
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
def _read_script(self, script_name, site_name, type): | |
script = "" | |
script += "<powershell>\n\n" | |
# set environment variable | |
script += " [Environment]::SetEnvironmentVariable(\"ENVNAME\", \"" + site_name + "\", \"Machine\")\n" | |
script += " [Environment]::SetEnvironmentVariable(\"NTPSERVER\", \"ntp." + site_name + "\", \"Machine\")\n" | |
script += " [Environment]::SetEnvironmentVariable(\"PREPDIR\", \"C:\\AmazonEnvPrep-v2012\", \"Machine\")\n" | |
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 install_app_utilities { | |
package { 'install java': | |
ensure => '7.51', | |
source => 'C:\Prepfolder\3rdParty\Java\jre-7u51-windows-x64.exe', | |
install_options => ['/s'] | |
} | |
package { 'install membase': |
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 install_utilities { | |
package { 'install python': | |
ensure => '2.7.2.5', | |
source => 'C:\Prepfolder\3rdParty\Python\ActivePython-2.7.2.5-win64-x64.msi', | |
install_options => ['/quiet'] | |
} | |
package { 'install notepad': |
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 install_web_utilities { | |
require web_config # It requires web_config class to be executed prior to installing IIS Modules | |
package { 'install rewrite': | |
ensure => '2.0', | |
source => 'C:\Prepfolder\3rdParty\IISModules\rewrite_2.0_rtw_x64.msi', | |
install_options => ['/quiet'] | |
} | |
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 web_config{ | |
# c:\windows\sysnative\windowspowershell\v1.0\powershell.exe - forces 64-bit PS | |
# https://tickets.puppetlabs.com/browse/MODULES-953 | |
exec { 'exec web_config.ps1': | |
command => 'c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -executionpolicy remotesigned -file C:\ProgramData\PuppetLabs\puppet\etc\modules\web_config\manifests\web_config.ps1', | |
logoutput => true, | |
timeout => 1800, | |
} |
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
# | |
# powershell logger function | |
# | |
function log ([string]$logdata) | |
{ | |
$date = get-date | |
Write-Output "$date - $logdata" | Out-File $log -width 240 -Append | |
} | |
log "Script started" |
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
if $envtype == 'distributed_prod' | |
{ | |
include app_config | |
include install_newrelic_server | |
include dns_suffix_prod | |
include install_sts_prod | |
include grant_cert_perm_prod | |
include task_windows_time | |
} | |
elsif $envtype == 'distributed_test' |
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
# | |
# Returns True if Password matches, False otherwise | |
# | |
Function Test-UserCredential { | |
Param($username, $password) | |
Add-Type -AssemblyName System.DirectoryServices.AccountManagement | |
$ct = [System.DirectoryServices.AccountManagement.ContextType]::Machine, $env:computername | |
$opt = [System.DirectoryServices.AccountManagement.ContextOptions]::SimpleBind | |
$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList $ct | |
$Result = $pc.ValidateCredentials($username, $password).ToString() |
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
# | |
# to send emails via Amazon SES SMTP (TLS) | |
# | |
def sendMail(self, subject, email_content): | |
import smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEBase import MIMEBase | |
from email import Encoders |
OlderNewer