Add directive to support alternate DNS server for windows deployments if DHCP is not to be trusted

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15661 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2013-03-25 20:02:04 +00:00
parent 4b2e5beb12
commit e5755dbc64

View File

@ -219,6 +219,7 @@ sub subvars {
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
$inc =~ s/#WINADJOIN#/windows_join_data()/eg;
$inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
$inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
$inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
$inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
@ -333,6 +334,35 @@ sub windows_account_data {
$useraccountxml.="<DomainAccounts><DomainAccountList>\r\n<DomainAccount wcm:action=\"add\">\r\n<Group>Administrators</Group>\r\n<Name>Domain Admins</Name>\r\n</DomainAccount>\r\n<Domain>".$domain."</Domain>\r\n</DomainAccountList>\r\n</DomainAccounts>\r\n";
return $useraccountxml;
}
sub windows_dns_cfg {
my $domain;
my $doment;
my $noderesent;
my $noderestab = xCAT::Table->new("noderes",-create=>0);
unless ($noderestab) { return ""; }
$noderesent = $noderestab->getNodeAttribs($node,['nameservers'],prefetchcache=>1);
unless ($noderesent and $noderesent->{nameservers}) { return ""; }
my $nameservers = $noderesent->{nameservers};
my $domaintab = xCAT::Table->new('domain',-create=>0);
if ($domaintab) {
$doment = $domaintab->getNodeAttribs($node,['authdomain'],prefetchcache=>1);
}
if ($doment and $doment->{authdomain}) {
$domain = $doment->{authdomain};
} else {
$domain = $::XCATSITEVALS{domain};
}
my $componentxml = '<component name="Microsoft-Windows-DNS-Client" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'."\r\n<DNSDomain>$domain</DNSDomain>\r\n".
"<Interfaces><Interface wcm:action=\"add\">\r\n<Identifier>==PRINIC==</Identifier>\r\n<DNSServerSearchOrder>\r\n";
my $idx=1;
foreach (split /,/,$nameservers) {
$componentxml.="<IpAddress wcm:action=\"add\" wcm:keyValue=\"$idx\">$_</IpAddress>\r\n";
$idx+=1;
}
$componentxml .= "</Interface>\r\n</Interfaces>\r\n</component>\r\n";
return $componentxml;
}
#this will examine table data, decide *if* a Microsoft-Windows-UnattendedJoin is warranted
#there are two variants in how to proceed:
#-Hide domain administrator from node: xCAT will use MACHINEPASSWORD to do joining to AD. Currently requires SSL be enabled on DC. Samba 4 TODO