Skip to content

Instantly share code, notes, and snippets.

{
"SiteName": "test.internal-api_com",
"ParentFolder": "C:\\_ot\\web\\internal-api_com",
"SiteHostHeader": "test.internalapi.com",
"Hosts": [
{
"Name": "test.internalapi.com",
"IP": "127.0.0.1"
},
{
@stack72
stack72 / entire-hosts.pp
Created June 11, 2013 11:08
Sample to manage an entire host file on a Windows machine
class hosts {
file { 'hosts':
ensure => file,
path => 'c:/windows/system32/drivers/etc',
source => 'puppet:///modules/hosts/hosts',
notify => Exec['flush_dns'],
}
exec { 'flush_dns':
@stack72
stack72 / single-host.pp
Created June 11, 2013 11:11
Puppet manifest to manage a single host file entry on windows
class hosts {
host { 'www.mysite.com':
ip => '127.0.0.1',
host_aliases => [ 'mysite.com', 'secure.mysite.com' ],
notify => Exec['flush_dns'],
}
exec { 'flush_dns':
command => 'powershell.exe -executionpolicy unrestricted -Command "C:\windows\system32\ipconfig.exe /flushdns"',
@stack72
stack72 / disable_firewall.pp
Created June 11, 2013 11:18
Puppet Manifest to disable Windows Firewall
class disable_windows_firewall {
service { 'MpsSvc':
ensure => 'stopped',
}
}
@stack72
stack72 / 7zip_install.pp
Created June 11, 2013 11:25
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'
class install_my_certificate {
manage_sslcertificate{ "Mycert.co.uk": {
password => "my cert password",
certificate_location => "c:\path to cert",
cert_root_store => "LocalMachine",
cert_store_dir => "My"
}
}
Write-Output ("##teamcity[buildNumber '" + $OT_BRANCHTAG +"_" + $OT_VERSION + "']")
==> vmware: Deleting output directory...
Build 'vmware' errored: remove output-vmware/packer-vmware.plist: no such file or directory
==> Some builds didn't complete successfully and had errors:
--> vmware: remove output-vmware/packer-vmware.plist: no such file or directory
==> Builds finished but no artifacts were created.
exec { "prepare AD for exchange":
command => template('msexchange/ad_prep.ps1.erb'),
provider => powershell,
#onlyif => '' -- determin if this has already run? What if an existing exch is in the domain? What if you run it twice?
}
describe 'when downloading a file using a proxy server we want to check that the erb gets evaluated correctly' do
let(:title) {'Download DotNet 4.0'}
let(:params) { { :url => 'http://myserver.com/test.exe', :destination => 'c:\temp', :proxyAddress => 'test-proxy-01:8888' } }
it { should contain_file('download-test.exe.ps1').with_content(
"$webclient = New-Object System.Net.WebClient
$proxyAddress = 'test-proxy-01:8888'
if ($proxyAddress -ne '') {
if (!$proxyAddress.StartsWith('http://')) {
$proxyAddress = 'http://' + $proxyAddress