diff --git a/Puppetfile b/Puppetfile index c70250a..276dee6 100644 --- a/Puppetfile +++ b/Puppetfile @@ -24,11 +24,13 @@ mod 'puppetlabs-wsus_client', '3.1.0' mod 'puppetlabs-accounts', '6.1.0' mod 'puppetlabs-dism', '1.3.1' mod 'puppetlabs-dsc', '1.9.4' +mod 'puppetlabs-dsc_lite', '3.0.1' mod 'puppetlabs-acl', '3.1.0' mod 'puppetlabs-iis', '7.0.0' mod 'puppetlabs-pwshlib', '0.4.0' mod 'puppet-archive', '4.4.0' mod 'puppet-staging', '3.2.0' +mod 'puppetlabs-reboot', '2.4.0' # Modules from Git # Examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples diff --git a/site-modules/custom_files/7z1900-x64.exe b/site-modules/custom_files/7z1900-x64.exe new file mode 100644 index 0000000..406b131 Binary files /dev/null and b/site-modules/custom_files/7z1900-x64.exe differ diff --git a/site-modules/custom_files/master.zip b/site-modules/custom_files/master.zip new file mode 100644 index 0000000..1b5d266 Binary files /dev/null and b/site-modules/custom_files/master.zip differ diff --git a/site-modules/profile/manifests/custom_windows.pp b/site-modules/profile/manifests/custom_windows.pp index f7ab9da..bf0532a 100644 --- a/site-modules/profile/manifests/custom_windows.pp +++ b/site-modules/profile/manifests/custom_windows.pp @@ -1,8 +1,17 @@ class profile::custom_windows ( - Boolean $config_server = true, + Boolean $config_server = true, + Boolean $install_package = true, + Boolean $deploy_iis = true, ) { if $config_server { class { '::profile::custom_windows::config_server': } + } + if $install_package { + class { '::profile::custom_windows::install_package': } include chocolatey + include staging + } + if $deploy_iis { + class { '::profile::custom_windows::deploy_iis': } } } diff --git a/site-modules/profile/manifests/custom_windows/.config_server.pp.swp b/site-modules/profile/manifests/custom_windows/.config_server.pp.swp deleted file mode 100644 index 5b05d59..0000000 Binary files a/site-modules/profile/manifests/custom_windows/.config_server.pp.swp and /dev/null differ diff --git a/site-modules/profile/manifests/custom_windows/1 b/site-modules/profile/manifests/custom_windows/1 deleted file mode 100644 index 26fb7dc..0000000 --- a/site-modules/profile/manifests/custom_windows/1 +++ /dev/null @@ -1,61 +0,0 @@ -class profile::custom_windows::config_server ( - - $user_name = 'myuser', - $user_group = 'mygroup', - $user_groups = ['BUILTIN\Administrators', 'BUILTIN\Users'], - $user_home = "C:\Users\myuser", - $user_password = 'puppet', - $ensure = 'present', - $manage_home = true, - $user_file = 'myfile', - -) { - - profile::custom_windows::define_user { 'myuser': - - user_name => $user_name, - user_group => $user_group, - user_groups => $user_groups, - user_home => $user_home, - user_password => $user_password, - ensure => $ensure, - manage_home => $manage_home, - user_file => $user_file, - } - - acl { 'C:\\Users\\myuser\myfile': - - permissions => [ - { identity => $user_name, rights => ['read','execute'] }, - { identity => $user_group, rights => ['read'] } - ], - } - - registry::value { 'Enable IEESC': - - key => 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}', - value => 'IsInstalled', - data => '1', - type => 'dword', - } - - registry::value { 'Enable shutdown tracker': - - key => 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability', - value => 'ShutdownReasonOn', - data => '1', - type => 'dword', - } - - registry::value { 'Enable shutdown tracker UI': - - key => 'HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability', - value => 'ShutdownReasonUI', - data => '1', - type => 'dword', - } - - class {'chocolatey': - log_output => true, - } -} diff --git a/site-modules/profile/manifests/custom_windows/config_server.pp b/site-modules/profile/manifests/custom_windows/config_server.pp index bc0a6d6..28d86ed 100644 --- a/site-modules/profile/manifests/custom_windows/config_server.pp +++ b/site-modules/profile/manifests/custom_windows/config_server.pp @@ -3,11 +3,11 @@ class profile::custom_windows::config_server ( $user_name = 'myuser', $user_group = 'mygroup', $user_groups = ['BUILTIN\Administrators', 'BUILTIN\Users'], - $user_home = "C:\Users\myuser", + $user_home = "C:/Users/myuser", $user_password = 'puppet', $ensure = 'present', $manage_home = true, - $user_file = 'myfile', + $user_dir = 'mydir', ) { @@ -20,10 +20,10 @@ class profile::custom_windows::config_server ( user_password => $user_password, ensure => $ensure, manage_home => $manage_home, - user_file => $user_file, + user_dir => $user_dir, } - acl { 'C:\\Users\\myuser\myfile': + acl { "${user_home}/${user_dir}": permissions => [ { identity => $user_name, rights => ['read','execute'] }, @@ -37,7 +37,7 @@ class profile::custom_windows::config_server ( value => 'IsInstalled', data => '1', type => 'dword', - } + } registry::value { 'Enable shutdown tracker': @@ -54,30 +54,4 @@ class profile::custom_windows::config_server ( data => '1', type => 'dword', } - - class {'chocolatey': - log_output => true, - choco_install_location => 'c:\choco', - } - - chocolateysource {'custom_source': - ensure => present, - location => 'c:\packages', - provider => windows, - } - - chocolateyfeature {'allowEmptyChecksums': - ensure => enabled, - provider => windows, - } - - chocolateyconfig {'cacheLocation': - value => 'c:\ProgramData\choco-cache', - provider => windows, - } - - package { '7zip': - ensure => '19.0', - provider => 'chocolatey', - } } diff --git a/site-modules/profile/manifests/custom_windows/define_user.pp b/site-modules/profile/manifests/custom_windows/define_user.pp index 6d49589..13466f4 100644 --- a/site-modules/profile/manifests/custom_windows/define_user.pp +++ b/site-modules/profile/manifests/custom_windows/define_user.pp @@ -5,12 +5,12 @@ define profile::custom_windows::define_user ( String $user_group, Optional[Array] $user_groups, String $user_password, - String $user_file, + String $user_dir, String $user_home, Boolean $manage_home, ) { - file { "${user_home}\\${user_file}": + file { "${user_home}/${user_dir}": ensure => directory, owner => $user_name, require => User[$user_name], @@ -21,7 +21,7 @@ define profile::custom_windows::define_user ( password => $user_password, groups => $user_group, managehome => $manage_home, - home => "C:\\Users\\$user_name", + home => "C:/Users/$user_name", require => Group[$user_group], } diff --git a/site-modules/profile/manifests/custom_windows/deploy_iis.pp b/site-modules/profile/manifests/custom_windows/deploy_iis.pp new file mode 100644 index 0000000..a098a04 --- /dev/null +++ b/site-modules/profile/manifests/custom_windows/deploy_iis.pp @@ -0,0 +1,10 @@ +class profile::custom_windows::deploy_iis ( + +) { + + dsc_windowsfeature {'IIS': + dsc_ensure => 'present', + dsc_name => 'Web-Server', + } + +} diff --git a/site-modules/profile/manifests/custom_windows/install_package.pp b/site-modules/profile/manifests/custom_windows/install_package.pp new file mode 100644 index 0000000..8bf45ac --- /dev/null +++ b/site-modules/profile/manifests/custom_windows/install_package.pp @@ -0,0 +1,66 @@ +class profile::custom_windows::install_package ( + + String $package = 'undef', + String $version = 'undef', + String $package_provider = 'chocolatey', + String $choco_provider = 'windows', + String $install_dir = $profile::custom_windows::config_server::user_home, + +) { + + chocolateysource {'custom_source': + ensure => present, + + location => 'c:\packages', + provider => $choco_provider, + } + + chocolateyfeature {'allowEmptyChecksums': + ensure => enabled, + provider => $choco_provider, + } + + chocolateyconfig {'cacheLocation': + value => 'c:\ProgramData\choco-cache', + provider => $choco_provider, + } + + package { 'unzip': + ensure => '6.0', + provider => $package_provider, + } + + class { 'staging': + path => 'C:/tmp', + } + + staging::file { 'master.zip': + source => 'puppet:///custom_files/master.zip', + } + + staging::extract { 'master.zip': + target => "${install_dir}/downloads", + #unless => '7z', + unless => 'cmd.exe /c type C:\tmp\7zip', + require => Staging::File['master.zip'], + } + + exec { '7z1900-x64': + cwd => "${install_dir}/downloads", + command => 'cmd.exe /c C:\Users\myuser\Downloads\7z1900-x64.exe', + path => $::path, + unless => 'cmd.exe /c type C:\tmp\7zip', + require => Staging::Extract['master.zip'], + } + + file { 'C:/tmp/7zip': + ensure => present, + content => installed, + require => Exec['7z1900-x64'], + } + + reboot { 'post_exec': + apply => finished, + subscribe => File['C:/tmp/7zip'], + } +}