-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #36495 - Extend Windows templates for Puppet and Ansible #9732
base: develop
Are you sure you want to change the base?
Fixes #36495 - Extend Windows templates for Puppet and Ansible #9732
Conversation
84db3dc
to
e589d01
Compare
1cf378d
to
fdee96a
Compare
fdee96a
to
10249a3
Compare
app/views/unattended/provisioning_templates/script/windows_default_script.erb
Show resolved
Hide resolved
-%> | ||
<% | ||
system_locale = host_param('systemLocale') ? host_param('systemLocale') : 'en-US' | ||
system_ui_lang = host_param('systemUILanguage') ? host_param('systemUILanguage') : 'en-US' | ||
setup_ui_lang = 'en-US' | ||
input_locale = host_param('inputLocale') ? host_param('inputLocale'): 'de-DE' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really want to set the german keyboard-layout as the default?
I would use the en-US one as default for the foreman-community
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, thanks!
app/views/unattended/provisioning_templates/finish/windows_default_finish.erb
Outdated
Show resolved
Hide resolved
10249a3
to
6f1693b
Compare
@ekohl Anything else that should be improved? |
cf9b139
to
46f0184
Compare
@ekohl @sbernhard Can we move forward here? |
app/views/unattended/provisioning_templates/finish/windows_default_finish.erb
Outdated
Show resolved
Hide resolved
app/views/unattended/provisioning_templates/finish/windows_default_finish.erb
Outdated
Show resolved
Hide resolved
echo Configuring Puppet | ||
mkdir "C:\ProgramData\PuppetLabs\puppet\etc" | ||
echo [main] > "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo server=http://<%= @host.puppetmaster %> >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this shouldn't be needed (see below), but if it is: server is the hostname, there's no protocol. Also, puppet_puppet_server
is the current macro. `@host.puppetmaster is deprecated.
echo server=http://<%= @host.puppetmaster %> >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | |
echo server=<%= host_puppet_server %> >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" |
mkdir "C:\ProgramData\PuppetLabs\puppet\etc" | ||
echo [main] > "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed now? I suspected the puppet.msi
(which is still there) would be sufficient.
echo [main] > "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo server=http://<%= @host.puppetmaster %> >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo autoflush=true >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo Installing Puppet | ||
start /w "" msiexec /qn /i C:\extras\puppet.msi PUPPET_AGENT_STARTUP_MODE=Manual PUPPET_MASTER_SERVER=<%= host_puppet_server -%> PUPPET_AGENT_ACCOUNT_DOMAIN=<%= @host.domain -%> PUPPET_AGENT_ACCOUNT_USER=administrator PUPPET_AGENT_ACCOUNT_PASSWORD="<%= host_param('domainAdminAccountPasswd') -%>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect PUPPET_MASTER_SERVER
is wrong here. Reading https://www.puppet.com/docs/puppet/7/install_agents#msi_properties I think it should be:
start /w "" msiexec /qn /i C:\extras\puppet.msi PUPPET_AGENT_STARTUP_MODE=Manual PUPPET_MASTER_SERVER=<%= host_puppet_server -%> PUPPET_AGENT_ACCOUNT_DOMAIN=<%= @host.domain -%> PUPPET_AGENT_ACCOUNT_USER=administrator PUPPET_AGENT_ACCOUNT_PASSWORD="<%= host_param('domainAdminAccountPasswd') -%>" | |
start /w "" msiexec /qn /i C:\extras\puppet.msi PUPPET_AGENT_STARTUP_MODE=Manual PUPPET_SERVER=<%= host_puppet_server -%> PUPPET_AGENT_ACCOUNT_DOMAIN=<%= @host.domain -%> PUPPET_AGENT_ACCOUNT_USER=administrator PUPPET_AGENT_ACCOUNT_PASSWORD="<%= host_param('domainAdminAccountPasswd') -%>" |
It should also set PUPPET_CA_SERVER=<%= host_puppet_ca_server>%
.
mkdir "C:\ProgramData\PuppetLabs\puppet\etc" | ||
echo [main] > "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo server=http://<%= @host.puppetmaster %> >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" | ||
echo autoflush=true >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to look this up, but https://www.puppet.com/docs/puppet/7/configuration.html#autoflush says this should be default:
echo autoflush=true >> "C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf" |
<% if puppet_enabled %> | ||
echo Installing puppet | ||
echo Downloading Puppet installer | ||
wget "<%= host_param('win_puppet_source') %>" -O C:\puppet-agent-x64-latest.msi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the path below (C:\extras\puppet.msi
) so likely to cause problems.
app/views/unattended/provisioning_templates/finish/windows_default_finish.erb
Outdated
Show resolved
Hide resolved
app/views/unattended/provisioning_templates/finish/windows_default_finish.erb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consistently use -%>
, at least for newly added blocks.
<%# | ||
Adjust power setting to 'High performance' | ||
-%> | ||
powershell /c "powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really appropriate for this PR? I can't speak for Windows admins since I rarely touch it, but doing this unconditionally may not be correct for users.
Thanks, I'll try to unify the templates. Working on the other changes as well, thank you for your input! Highly appreciated! |
bfdc6e2
to
fdc3ae6
Compare
2110b99
to
8f86591
Compare
@ekohl I cleaned up the tags (hope I got them all) and modified the configurations in question. Right now, there are three commits for better visibility of the changes. Do you mind having another look? |
@ekohl Anything else that needs fixing? |
8f86591
to
79e0aa3
Compare
79e0aa3
to
db15470
Compare
db15470
to
bc5f63a
Compare
90593d5
to
c0a5564
Compare
c0a5564
to
4b939a4
Compare
Co-authored-by: Fabrice Brimioulle <brimioulle@atix.de> Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
b8002a1
to
156840e
Compare
|
||
|
||
@echo off | ||
echo Activating administrator | ||
net user administrator /active:yes | ||
|
||
set ctr=0 | ||
set nettimeout=10 | ||
|
||
@echo off | ||
setlocal enableDelayedExpansion | ||
|
||
for /f "delims=" %%a in ('ipconfig /all') do ( | ||
set line=%%a | ||
if not "!line:~0,1!"==" " if not "!line:adapter=!"=="!line!" ( | ||
set name=!line:*adapter =! | ||
set name=!name::=! | ||
) | ||
|
||
for /f "tokens=1,2,*" %%b in ("%%a") do ( | ||
if "%%b %%c"=="Physical Address." ( | ||
set mac=%%d | ||
set mac=!mac:*: =! | ||
set mac=!mac:-=:! | ||
call :tolower mac | ||
|
||
) | ||
) | ||
) | ||
call :done | ||
|
||
:tolower | ||
for %%L IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO SET %1=!%1:%%L=%%L! | ||
goto :EOF | ||
|
||
:done | ||
|
||
|
||
|
||
echo Syncing time | ||
w32tm /resync | ||
w32tm /resync | ||
|
||
|
||
|
||
|
||
powershell /c "Get-NetConnectionProfile -InterfaceAlias \"Ethernet0\" | Set-NetConnectionProfile -NetworkCategory Private" | ||
|
||
|
||
|
||
|
||
echo Downloading Puppet installer | ||
wget "" -O C:\puppet-agent-x64-latest.msi | ||
echo Installing Puppet | ||
start /w "" msiexec /qn /i C:\puppet-agent-x64-latest.msi PUPPET_AGENT_STARTUP_MODE=Manual PUPPET_SERVER= PUPPET_AGENT_ACCOUNT_DOMAIN=snap.example.com PUPPET_AGENT_ACCOUNT_USER=administrator PUPPET_AGENT_ACCOUNT_PASSWORD="" | ||
echo Setting Puppet to auto start | ||
sc config puppet start= auto | ||
sc query puppet | ||
|
||
echo Rebooting in 60 sec | ||
shutdown /r /t 60 | ||
|
||
echo Removing wimaging files | ||
rd /s /q c:\wimaging | ||
sdelete.exe -accepteula -p 2 c:\Windows\Panther\unattend.xml | ||
sdelete.exe -accepteula -p 2 C:\Windows\Setup\Scripts\SetupComplete.cmd | ||
|
||
echo Removing leftover directories | ||
rd /s /q c:\MININT | ||
rd /s /q c:\drivers | ||
rd /s /q c:\updates | ||
|
||
echo Removing Puppet installer | ||
sdelete.exe -accepteula -p 2 C:\puppet-agent-x64-latest.msi | ||
|
||
echo Removing deploy directory | ||
rd /s /q c:\deploy | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation-wise, this template snapshot looks kind of funny....
No description provided.