Puppet Class: windows_ad
- Defined in:
- manifests/init.pp
Overview
Help can be found in readme.rd for a global help
Authors
Jerome RIVIERE (www.jerome-riviere.re)
Copyright
Copyright 2014 Jerome RIVIERE.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'manifests/init.pp', line 12
class windows_ad (
### part install AD
$install = 'present',
$installmanagementtools = true,
$installsubfeatures = false,
$restart = false,
$installflag = true, # Flag to bypass the install of AD if desired
### Part Configure AD - Global
$configure = 'present',
$domain = 'forest',
$domainname = undef, # FQDN
$netbiosdomainname = undef, # FQDN
$configureflag = true, # Flag to bypass the configuration of AD if desired
#level AD
$domainlevel = '6', # Domain level {4 - Server 2008 R2 | 5 - Server 2012 | 6 - Server 2012 R2}
$forestlevel = '6', # Domain level {4 - Server 2008 R2 | 5 - Server 2012 | 6 - Server 2012 R2}
$installdns = 'yes', # Add DNS Server Role
$globalcatalog = 'yes', # Add Global Catalog functionality
$kernel_ver = $::kernelversion,
# Installation Directories
$databasepath = 'c:\\windows\\ntds', # Active Directory database path
$logpath = 'c:\\windows\\ntds', # Active Directory log path
$sysvolpath = 'c:\\windows\\sysvol', # Active Directory sysvol path
$dsrmpassword = undef,
### Part Configure AD - Forest
#uninstall forest
$localadminpassword = undef,
$force = true,
$forceremoval = true,
$uninstalldnsrole = 'yes',
$demoteoperationmasterrole = true,
### Part Configure AD - Other
$secure_string_pwd = undef,
$installtype = undef, # New domain or replica of existing domain {replica | domain}
$domaintype = undef, # Type of domain {Tree | Child | Forest} (New domain tree in an existing forest, child domain, or new forest)
$sitename = undef, # Site Name
### Define Hiera hashes
$groups = undef,
$groups_hiera_merge = true,
$users = undef,
$users_hiera_merge = true,
$usersingroup = undef,
$usersingroup_hiera_merge = true,
) {
# when present install process will be set. if already install nothing done
# when absent uninstall will be launch
validate_re($install, '^(present|absent)$', 'valid values for install are \'present\' or \'absent\'')
# when present configure process will be done. if already configure nothing done
# absent don't do anything right now
validate_re($configure, '^(present|absent)$', 'valid values for configure are \'present\' or \'absent\'')
validate_bool($configureflag)
validate_bool($installflag)
class{'windows_ad::install':
ensure => $install,
installmanagementtools => $installmanagementtools,
installsubfeatures => $installsubfeatures,
restart => $restart,
installflag => $installflag,
}
class{'windows_ad::conf_forest':
ensure => $configure,
domainname => $domainname,
netbiosdomainname => $netbiosdomainname,
domainlevel => $domainlevel,
forestlevel => $forestlevel,
globalcatalog => $globalcatalog,
databasepath => $databasepath,
logpath => $logpath,
sysvolpath => $sysvolpath,
dsrmpassword => $dsrmpassword,
installdns => $installdns,
kernel_ver => $kernel_ver,
localadminpassword => $localadminpassword,
force => $force,
forceremoval => $forceremoval,
uninstalldnsrole => $uninstalldnsrole,
demoteoperationmasterrole => $demoteoperationmasterrole,
configureflag => $configureflag,
}
if($installflag or $configureflag){
if($install == 'present'){
anchor{'windows_ad::begin':} -> Class['windows_ad::install'] -> Class['windows_ad::conf_forest'] -> anchor{'windows_ad::end':} -> Windows_ad::Organisationalunit <| |> -> Windows_ad::Group <| |> -> Windows_ad::User <| |> -> Windows_ad::Groupmembers <| |>
}else{
if($configure == present){
fail('You can\'t desactivate the Role ADDS without uninstall ADDSControllerDomain first')
}else{
anchor{'windows_ad::begin':} -> Class['windows_ad::conf_forest'] -> Class['windows_ad::install'] -> anchor{'windows_ad::end':}
}
}
}else{
anchor{'windows_ad::begin':} -> Windows_ad::Organisationalunit <| |> -> Windows_ad::Group <| |> -> Windows_ad::User <| |> -> Windows_ad::Groupmembers <| |> -> anchor{'windows_ad::end':}
}
if type($groups_hiera_merge) == 'string' {
$groups_hiera_merge_real = str2bool($groups_hiera_merge)
} else {
$groups_hiera_merge_real = $groups_hiera_merge
}
validate_bool($groups_hiera_merge_real)
if $groups != undef {
if $groups_hiera_merge_real == true {
$groups_real = hiera_hash('windows_ad::groups')
} else {
$groups_real = $groups
}
validate_hash($groups_real)
create_resources('windows_ad::group',$groups_real)
}
if type($users_hiera_merge) == 'string' {
$users_hiera_merge_real = str2bool($users_hiera_merge)
} else {
$users_hiera_merge_real = $users_hiera_merge
}
validate_bool($users_hiera_merge_real)
if $users != undef {
if $users_hiera_merge_real == true {
$users_real = hiera_hash('windows_ad::users')
} else {
$users_real = $users
}
validate_hash($users_real)
create_resources('windows_ad::user',$users_real)
}
if type($usersingroup_hiera_merge) == 'string' {
$usersingroup_hiera_merge_real = str2bool($usersingroup_hiera_merge)
} else {
$usersingroup_hiera_merge_real = $usersingroup_hiera_merge
}
validate_bool($usersingroup_hiera_merge_real)
if $usersingroup != undef {
if $usersingroup_hiera_merge_real == true {
$usersingroup_real = hiera_hash('windows_ad::usersingroup')
} else {
$usersingroup_real = $usersingroup
}
validate_hash($usersingroup_real)
create_resources('windows_ad::groupmembers',$usersingroup_real)
}
}
|