adding windows and users group modules including defining a user_type for testing

This commit is contained in:
christopher.lawrence 2020-02-06 16:16:35 +00:00
parent 41575b9c58
commit 91e8192a61
6 changed files with 54 additions and 4 deletions

View File

@ -20,6 +20,10 @@ mod 'puppetlabs-registry', '3.1.0'
mod 'puppetlabs-powershell', '3.0.1'
mod 'puppet-windowsfeature', '3.2.2'
mod 'puppetlabs-chocolatey', '5.0.2'
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'
# Modules from Git
# Examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples

View File

@ -1,5 +1,5 @@
class os::win {
if $osfamily == 'windows' {
if $facts[osfamily] == 'windows' {
include role::custom_windows
}
}

View File

@ -1,6 +1,7 @@
class profile::custom_windows (
Boolean $custom_account = false,
if $custom_account {
class { '::profile::windows::custom_account': }
Boolean $add_user = true,
) {
if $add_user {
class { '::profile::custom_windows::add_user': }
}
}

View File

@ -0,0 +1,14 @@
class profile::custom_windows::add_user {
profile::custom_windows::define_user { 'myuser':
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',
}
}

View File

@ -0,0 +1,31 @@
define profile::custom_windows::define_user (
String $user_name,
String $ensure,
String $user_group,
Optional[Array] $user_groups,
String $user_password,
String $user_file,
String $user_home,
Boolean $manage_home,
) {
file { "${user_home}\\${user_file}":
ensure => directory,
owner => $user_name,
require => User[$user_name],
}
user { $user_name:
ensure => $ensure,
password => $user_password,
groups => $user_group,
managehome => $manage_home,
home => "C:\\Users\\$user_name",
require => Group[$user_group],
}
group { $user_group:
ensure => $ensure,
}
}