From 8cf16b5c899a60ea5982c5d8dc042153daf6ac5b Mon Sep 17 00:00:00 2001 From: heqnx Date: Fri, 11 Jul 2025 21:50:55 +0300 Subject: added packer templates --- .../linux/ubuntu/24.04-server/meta-data | 0 .../linux/ubuntu/24.04-server/user-data | 39 +++++ .../answer_files/windows/2019/autounattend.xml | 176 +++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 packer/files/answer_files/linux/ubuntu/24.04-server/meta-data create mode 100644 packer/files/answer_files/linux/ubuntu/24.04-server/user-data create mode 100644 packer/files/answer_files/windows/2019/autounattend.xml (limited to 'packer/files/answer_files') diff --git a/packer/files/answer_files/linux/ubuntu/24.04-server/meta-data b/packer/files/answer_files/linux/ubuntu/24.04-server/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/packer/files/answer_files/linux/ubuntu/24.04-server/user-data b/packer/files/answer_files/linux/ubuntu/24.04-server/user-data new file mode 100644 index 0000000..5e02023 --- /dev/null +++ b/packer/files/answer_files/linux/ubuntu/24.04-server/user-data @@ -0,0 +1,39 @@ +#cloud-config +autoinstall: + version: 1 + early-commands: + - systemctl stop ssh + locale: en_US.UTF-8 + keyboard: + layout: us + variant: "" + storage: + layout: + name: lvm + identity: + hostname: ubuntu + username: ubuntu + password: "$6$R9142dko7PYoTTJP$o19g/Av.dsI/fVEF4SJ8v0XqRcG6YdhQRGYLFrW2X4BG4gO2z3dWyOwio3pRrFXBMHNZHJlZPUp9yvR7elRKs0" + ssh: + allow-pw: true + install-server: true + user-data: + disable_root: false + runcmd: + - 'echo "root:root" | chpasswd' + late-commands: + - rm -rf /target/etc/apt/preferences.d/90curtin.pref + - curtin in-target --target=/target -- lvextend --extents +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv + - curtin in-target --target=/target -- resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv + - echo 'PermitRootLogin yes' >> /target/etc/ssh/sshd_config + - chmod -x /target/etc/update-motd.d/* + - | + cat << EOF > /target/etc/netplan/99-dhcp-any-interface.yaml + network: + ethernets: + any_interface: + match: + name: "e*" + dhcp4: true + version: 2 + EOF diff --git a/packer/files/answer_files/windows/2019/autounattend.xml b/packer/files/answer_files/windows/2019/autounattend.xml new file mode 100644 index 0000000..1f87720 --- /dev/null +++ b/packer/files/answer_files/windows/2019/autounattend.xml @@ -0,0 +1,176 @@ + + + + + + en-US + + en-US + en-US + en-US + en-US + + + + + e:\ + + + + + + + + + Primary + 1 + 350 + + + 2 + Primary + true + + + + + true + NTFS + + 1 + 1 + + + NTFS + + C + 2 + 2 + + + 0 + true + + + + + + + /IMAGE/NAME + Windows Server 2019 SERVERSTANDARD + + + + 0 + 2 + + + + + true + + + + + + + true + true + true + true + 3 + + + + + + packer + true</PlainText> + </Password> + <Group>Administrators</Group> + <Name>packer</Name> + <DisplayName>packer</DisplayName> + </LocalAccount> + </LocalAccounts> + <AdministratorPassword> + <Value>packer</Value> + <PlainText>true</PlainText> + </AdministratorPassword> + </UserAccounts> + <AutoLogon> + <Username>packer</Username> + <Enabled>true</Enabled> + <Password> + <Value>packer</Value> + <PlainText>true</PlainText> + </Password> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <Order>1</Order> + <Description>Disable the network discovery prompt window</Description> + <RequiresUserInput>false</RequiresUserInput> + <CommandLine>reg.exe add HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff</CommandLine> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>2</Order> + <Description>Set Execution Policy 64 Bit</Description> + <RequiresUserInput>false</RequiresUserInput> + <CommandLine>cmd.exe /c powershell -c "set-executionpolicy -executionpolicy unrestricted -force"</CommandLine> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>3</Order> + <Description>Set Execution Policy 32 Bit</Description> + <RequiresUserInput>false</RequiresUserInput> + <CommandLine>c:\windows\syswow64\cmd.exe /c powershell -c "set-executionpolicy -executionpolicy unrestricted -force"</CommandLine> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <Order>500</Order> + <Description>Enable WinRM</Description> + <RequiresUserInput>false</RequiresUserInput> + <CommandLine>cmd.exe /c for %i 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 if exist %i:\enable-winrm-http.ps1 (call powershell -file %i:\enable-winrm-http.ps1)</CommandLine> + </SynchronousCommand> + </FirstLogonCommands> + </component> + <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UserLocale>en-US</UserLocale> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <FirewallGroups> + <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop"> + <Active>true</Active> + <Group>@FirewallAPI.dll,-28752</Group> + <Profile>all</Profile> + </FirewallGroup> + </FirewallGroups> + </component> + <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <SecurityLayer>1</SecurityLayer> + <UserAuthentication>0</UserAuthentication> + </component> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <CopyProfile>true</CopyProfile> + <TimeZone>UTC</TimeZone> + </component> + <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> + <IEHardenAdmin>false</IEHardenAdmin> + <IEHardenUser>false</IEHardenUser> + </component> + <component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + </settings> + <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> + -- cgit v1.2.3