Slide 1

Slide 1 text

Managing Windows with Puppet Experiences from the trenches

Slide 2

Slide 2 text

@liamjbennett

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Your turn

Slide 8

Slide 8 text

Not talking about

Slide 9

Slide 9 text

The puppet tool chain

Slide 10

Slide 10 text

Powershell

Slide 11

Slide 11 text

Puppet for all the things

Slide 12

Slide 12 text

This talk

Slide 13

Slide 13 text

The basic puppet types for windows The Good … and some of the new ones

Slide 14

Slide 14 text

Gotchas for Windows The Bad

Slide 15

Slide 15 text

Testing on Windows The Ugly

Slide 16

Slide 16 text

file { 'c:/mysql/my.ini': ensure => 'file', mode => '0660', owner => 'mysql', group => 'Administrators', source => 'N:/software/mysql/my.ini', } The Types I Like package { 'Git version 1.8.4': ensure => installed, source => 'N:/software/git-1.8.4.exe', install_options => '0660', } service { 'mysql': ensure => 'running', enable => true, }

Slide 17

Slide 17 text

exec { 'random script': command =>'cmd.exe /c type c:\path\to\file.txt', } The Types I Don’t Like user { 'bob': ensure => present, groups => ['Users','Administrators'], password => 'ouch', } schedule_task { 'another task': enable => true, command =>'cmd.exe /c type c:\path\to\file.txt’, trigger => { schedule => daily, } }

Slide 18

Slide 18 text

windowsfeature { 'Web-WebServer': installsubfeatures => true, } Other useful stuff registry_key { 'HKLM\System\CurrentControlSet\Services\Puppet': ensure => present, } exec { 'rename-guest': command => '$(SOME_POWERSHELL)', provider => powershell } reboot { 'after': subscribe => Package['SomePackage'] }

Slide 19

Slide 19 text

Other useful stuff iis::manage_app_pool { 'my_application_pool': enable_32_bit => true, managed_runtime_version => 'v4.0' } iis::manage_site { 'www.mysite.com': site_path => 'C:\inetpub\wwwroot\mysite', port => '80', ip_address => '*', host_header => 'www.mysite.com', app_pool => 'my_application_pool', } iis::manage_virtual_application { 'application1': site_name => 'www.mysite.com', site_path => 'C:\inetpub\wwwroot\application1', app_pool => 'my_application_pool', }

Slide 20

Slide 20 text

The Gotchas

Slide 21

Slide 21 text

File Paths file { 'c:/path/to/file.txt': } file { 'c:\path\to\file.txt': } file { "c:\\path\\to\\file.txt": }

Slide 22

Slide 22 text

file/acl file { 'c:/mysql/my.ini': ensure => 'file', mode => '0660', owner => 'mysql', group => 'Administrators', source => 'N:/software/mysql/my.ini', } acl { 'c:/mysql/my.ini': permissions => [ { identity => 'Administrator', rights => ['full'] }, { identity => 'Users', rights => ['read','execute'] } ], }

Slide 23

Slide 23 text

puppetlabs/acl

Slide 24

Slide 24 text

WOW3264 re-direction C:\Windows\System32\ C:\Windows\SysWOW64\

Slide 25

Slide 25 text

UAC Manually running puppet in a non- admin context -> Don’t do this.

Slide 26

Slide 26 text

WinRM Quotas winrm set winrm/config @{MaxTimeoutms="1800000"} winrm set winrm/config/winrs @{MaxMemoryPerShellMB=""}

Slide 27

Slide 27 text

Reboots Can’t install a package because of “waiting for reboot” state

Slide 28

Slide 28 text

puppetlabs/reboot

Slide 29

Slide 29 text

WTF Bugs KB2773898 - access denied installing msu KB2918614 - windows update that broke msi installs KB2842230 - ignores MaxMemoryPerShellMB

Slide 30

Slide 30 text

Testing

Slide 31

Slide 31 text

• rspec-puppet • beaker (with winrm) • serverspec • vagrant/packer • booting 4GB images

Slide 32

Slide 32 text

Questions? And thanks for listening

Slide 33

Slide 33 text

@liamjbennett [email protected] liamjbennett.me @OpenTableTechUK tech.opentable.co.uk