Skip to content

Commit 0d58986

Browse files
nyanhpJan-Hendrik Peters
andauthored
Update Autoyast SSSD conf (AutomatedLab#1769)
* Update Autoyast SSSD conf * smb-client stopped working * Suppress output * Cannot recycle attributes * Ensure Suse dependencies part of config * Lets try without validation * Remove Samba in favor of adcli * Simplify namespace * Add XML node types * Implent YAST sychronous command * Distinguish package and pattern * Ensure no duplicates * Closing tags * Use short-hand attribute * Yast seems to require ISO * Ensure DVD is mounted * Package not Pattern * Ensure FQDN is used to aid realm discovery * Ensure software selection can include sssd * Include NSM * Include NSM * Fix repo URls * Restore node attribute * DomJoin required samba still * Autobootloader * Move pwhs install * Include link to supported Linux versions * Fix typo * Use RPM to ignore dependenceies * Remove product dir * Add linuxrc config --------- Co-authored-by: Jan-Hendrik Peters <nyanhp@noreply.codeberg.org>
1 parent cb4228c commit 0d58986

File tree

9 files changed

+373
-232
lines changed

9 files changed

+373
-232
lines changed

AutomatedLabDefinition/internal/scripts/Initialization.ps1

Lines changed: 82 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -463,140 +463,133 @@ clearpart --all
463463
autopart
464464
"@
465465

466+
# Big XML, replace SUSEVERSION with Major.Minor and Codename with e.g. Leap
467+
# Tumbleweed has different repos (only non-oss and update with urls like https://download.opensuse.org/update/tumbleweed/)
468+
# Tumbleweed uses selinux instead of apparmor, bootload should be security=selinux selinux=1
469+
# SecureBoot can remain on, even if off or gen1
466470
$autoyastContent = @"
467471
<?xml version="1.0"?>
468472
<!DOCTYPE profile>
469473
<profile
470474
xmlns="http://www.suse.com/1.0/yast2ns"
471475
xmlns:config="http://www.suse.com/1.0/configns">
472-
<general>
473-
<signature-handling>
474-
<accept_unsigned_file config:type="boolean">true</accept_unsigned_file>
475-
<accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum>
476-
<accept_verification_failed config:type="boolean">true</accept_verification_failed>
477-
<accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key>
478-
<import_gpg_key config:type="boolean">true</import_gpg_key>
479-
<accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key>
476+
<general t="map">
477+
<signature-handling t="map">
478+
<accept_unsigned_file t="boolean">true</accept_unsigned_file>
479+
<accept_file_without_checksum t="boolean">true</accept_file_without_checksum>
480+
<accept_verification_failed t="boolean">true</accept_verification_failed>
481+
<accept_unknown_gpg_key t="boolean">true</accept_unknown_gpg_key>
482+
<import_gpg_key t="boolean">true</import_gpg_key>
483+
<accept_non_trusted_gpg_key t="boolean">true</accept_non_trusted_gpg_key>
480484
</signature-handling>
481-
<self_update config:type="boolean">false</self_update>
482-
<mode>
483-
<halt config:type="boolean">false</halt>
484-
<forceboot config:type="boolean">false</forceboot>
485-
<final_reboot config:type="boolean">true</final_reboot>
486-
<final_halt config:type="boolean">false</final_halt>
487-
<confirm_base_product_license config:type="boolean">false</confirm_base_product_license>
488-
<confirm config:type="boolean">false</confirm>
489-
<second_stage config:type="boolean">true</second_stage>
485+
<self_update t="boolean">false</self_update>
486+
<mode t="map">
487+
<halt t="boolean">false</halt>
488+
<forceboot t="boolean">false</forceboot>
489+
<final_reboot t="boolean">true</final_reboot>
490+
<final_halt t="boolean">false</final_halt>
491+
<confirm_base_product_license t="boolean">false</confirm_base_product_license>
492+
<confirm t="boolean">false</confirm>
493+
<second_stage t="boolean">true</second_stage>
490494
</mode>
491495
</general>
492-
<partitioning config:type="list">
493-
<drive>
494-
<disklabel>gpt</disklabel>
495-
<device>/dev/sda</device>
496-
<use>free</use>
497-
<partitions config:type="list">
498-
<partition>
499-
<filesystem config:type="symbol">vfat</filesystem>
500-
<mount>/boot</mount>
501-
<size>1G</size>
502-
</partition>
503-
<partition>
504-
<filesystem config:type="symbol">vfat</filesystem>
505-
<mount>/boot/efi</mount>
506-
<size>1G</size>
507-
</partition>
508-
<partition>
509-
<filesystem config:type="symbol">swap</filesystem>
510-
<mount>/swap</mount>
511-
<size>auto</size>
512-
</partition>
513-
<partition>
514-
<filesystem config:type="symbol">ext4</filesystem>
515-
<mount>/</mount>
516-
<size>auto</size>
517-
</partition>
518-
</partitions>
519-
</drive>
520-
</partitioning>
521-
<bootloader>
522-
<loader_type>grub2-efi</loader_type>
523-
<global>
524-
<activate config:type="boolean">true</activate>
525-
<boot_boot>true</boot_boot>
526-
</global>
527-
</bootloader>
528-
<language>
496+
<language t="map">
529497
<language>en_US</language>
530498
</language>
531-
<timezone>
499+
<timezone t="map">
532500
<!-- https://raw.githubusercontent.com/yast/yast-country/master/timezone/src/data/timezone_raw.ycp -->
533501
<hwclock>UTC</hwclock>
534502
<timezone>ETC/GMT</timezone>
535503
</timezone>
536-
<keyboard>
504+
<keyboard t="map">
537505
<!-- https://raw.githubusercontent.com/yast/yast-country/master/keyboard/src/data/keyboard_raw.ycp -->
538506
<keymap>english-us</keymap>
539507
</keyboard>
540-
<software>
541-
<patterns config:type="list">
508+
<add-on t="map">
509+
<add_on_others t="list">
510+
<listentry t="map">
511+
<alias>repo-backports-update</alias>
512+
<media_url>http://download.opensuse.org/update/leap/SUSEVERSION/backports/</media_url>
513+
<name>Backports Update</name>
514+
<priority t="integer">3</priority>
515+
</listentry>
516+
<listentry t="map">
517+
<alias>repo-non-oss</alias>
518+
<media_url>http://download.opensuse.org/distribution/leap/SUSEVERSION/repo/non-oss/</media_url>
519+
<name>Non-OSS Repository</name>
520+
<priority t="integer">2</priority>
521+
</listentry>
522+
<listentry t="map">
523+
<alias>repo-sle-update</alias>
524+
<media_url>http://download.opensuse.org/update/leap/SUSEVERSION/sle/</media_url>
525+
<name>Update from SLES</name>
526+
<priority t="integer">1</priority>
527+
</listentry>
528+
<listentry t="map">
529+
<alias>repo-update</alias>
530+
<media_url>http://download.opensuse.org/update/leap/SUSEVERSION/oss/</media_url>
531+
<name>Main Update Repository</name>
532+
<priority t="integer">4</priority>
533+
</listentry>
534+
<listentry t="map">
535+
<alias>repo-updatenon-oss</alias>
536+
<media_url>http://download.opensuse.org/update/leap/SUSEVERSION/non-oss/</media_url>
537+
<name>Non-OSS Update Repository</name>
538+
<priority t="integer">5</priority>
539+
</listentry>
540+
</add_on_others>
541+
</add-on>
542+
<software t="map">
543+
<patterns t="list">
542544
<pattern>base</pattern>
543545
<pattern>enhanced_base</pattern>
544546
</patterns>
545-
<install_recommended config:type="boolean">true</install_recommended>
546-
<packages config:type="list">
547+
<install_recommended t="boolean">true</install_recommended>
548+
<do_online_update t="boolean">false</do_online_update>
549+
<packages t="list">
547550
<package>iputils</package>
548551
<package>vim</package>
549552
<package>less</package>
550553
</packages>
551554
</software>
552-
<services-manager>
555+
<services-manager t="map">
553556
<default_target>multi-user</default_target>
554557
<services>
555-
<enable config:type="list">
558+
<enable t="list">
556559
<service>sshd</service>
557560
</enable>
558561
</services>
559562
</services-manager>
560-
<networking>
561-
<interfaces config:type="list">
563+
<networking t="map">
564+
<backend>wicked</backend>
565+
<setup_before_proposal t="boolean">true</setup_before_proposal>
566+
<start_immediately config:type="boolean">true</start_immediately>
567+
<interfaces t="list">
562568
</interfaces>
563-
<net-udev config:type="list">
569+
<net-udev t="list">
564570
</net-udev>
565-
<dns>
566-
<nameservers config:type="list">
571+
<dns t="map">
572+
<nameservers t="list">
567573
</nameservers>
568574
</dns>
569-
<routing>
570-
<routes config:type="list">
575+
<routing t="map">
576+
<routes t="list">
571577
</routes>
572578
</routing>
573579
</networking>
574-
<users config:type="list">
580+
<users t="list">
575581
<user>
576582
<username>root</username>
577583
<user_password>Password1</user_password>
578-
<encrypted config:type="boolean">false</encrypted>
584+
<encrypted t="boolean">false</encrypted>
579585
</user>
580586
</users>
581-
<firewall>
582-
<enable_firewall config:type="boolean">true</enable_firewall>
583-
<start_firewall config:type="boolean">true</start_firewall>
587+
<firewall t="map">
588+
<enable_firewall t="boolean">true</enable_firewall>
589+
<start_firewall t="boolean">true</start_firewall>
584590
</firewall>
585-
<scripts>
586-
<init-scripts config:type="list">
587-
<script>
588-
<source>
589-
<![CDATA[
590-
rpm --import https://packages.microsoft.com/keys/microsoft.asc
591-
rpm -Uvh https://packages.microsoft.com/config/sles/12/packages-microsoft-prod.rpm
592-
zypper update
593-
zypper -f -v install powershell omi openssl
594-
systemctl enable omid
595-
echo "Subsystem powershell /usr/bin/pwsh -sshs -NoLogo" >> /etc/ssh/sshd_config
596-
systemctl restart sshd
597-
]]>
598-
</source>
599-
</script>
591+
<scripts t="map">
592+
<init-scripts t="list">
600593
</init-scripts>
601594
</scripts>
602595
</profile>

AutomatedLabUnattended/internal/functions/Suse/Add-UnattendedYastNetworkAdapter.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@
137137
foreach ($gateway in $Gateways)
138138
{
139139
$routeNode = $script:un.CreateElement('route', $script:nsm.LookupNamespace('un'))
140+
$mapAttr = $script:un.CreateAttribute('t')
141+
$mapAttr.InnerText = 'map'
142+
$null = $routeNode.Attributes.Append($mapAttr)
140143
$destinationNode = $script:un.CreateElement('destination', $script:nsm.LookupNamespace('un'))
141144
$deviceNode = $script:un.CreateElement('device', $script:nsm.LookupNamespace('un'))
142145
$gatewayNode = $script:un.CreateElement('gateway', $script:nsm.LookupNamespace('un'))
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
function Add-UnattendedYastSynchronousCommand
2-
{
1+
function Add-UnattendedYastSynchronousCommand {
32
param (
43
[Parameter(Mandatory)]
54
[string]$Command,
@@ -8,4 +7,25 @@
87
[string]$Description
98
)
109

10+
# Init Scripts - run after the system is up and running
11+
$scriptsNode = $script:un.SelectSingleNode('/un:profile/un:scripts/un:init-scripts', $script:nsm)
12+
13+
# Add new script with GUID as filename (mandatory if more than one script)
14+
$scriptNode = $script:un.CreateElement('script', $script:nsm.LookupNamespace('un'))
15+
$mapAttr = $script:un.CreateAttribute('t')
16+
$mapAttr.InnerText = 'map'
17+
$null = $scriptNode.Attributes.Append($mapAttr)
18+
19+
$fileNameNode = $script:un.CreateElement('filename', $script:nsm.LookupNamespace('un'))
20+
$fileNameNode.InnerText = [guid]::NewGuid().ToString()
21+
$null = $scriptNode.AppendChild($fileNameNode)
22+
23+
# Add "source" node with CDATA content of $Command
24+
$sourceNode = $script:un.CreateElement('source', $script:nsm.LookupNamespace('un'))
25+
$cdata = $script:un.CreateCDataSection($Command)
26+
$null = $sourceNode.AppendChild($cdata)
27+
$null = $scriptNode.AppendChild($sourceNode)
28+
29+
# Append the script node to the scripts node
30+
$null = $scriptsNode.AppendChild($scriptNode)
1131
}
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
function Import-UnattendedYastContent
2-
{
1+
function Import-UnattendedYastContent {
32
param
43
(
54
[Parameter(Mandatory = $true)]
@@ -9,10 +8,10 @@ function Import-UnattendedYastContent
98

109
$script:un = $Content
1110
$script:ns = @{
12-
un = "http://www.suse.com/1.0/yast2ns"
13-
'un:config' = "http://www.suse.com/1.0/configns"
11+
xmlns = "http://www.suse.com/1.0/yast2ns"
12+
config = "http://www.suse.com/1.0/configns"
1413
}
15-
$script:nsm = [System.Xml.XmlNamespaceManager]::new($script:un.NameTable)
16-
$script:nsm.AddNamespace('un',"http://www.suse.com/1.0/yast2ns")
17-
$script:nsm.AddNamespace('un:config',"http://www.suse.com/1.0/configns" )
14+
$script:nsm = [System.Xml.XmlNamespaceManager]::new($script:un.NameTable)
15+
$script:nsm.AddNamespace('un', "http://www.suse.com/1.0/yast2ns")
16+
$script:nsm.AddNamespace('config', "http://www.suse.com/1.0/configns" )
1817
}

AutomatedLabUnattended/internal/functions/Suse/Set-UnattendedYastAdministratorName.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
$username = $script:un.CreateElement('username', $script:nsm.LookupNamespace('un'))
1212
$pw = $script:un.CreateElement('user_password', $script:nsm.LookupNamespace('un'))
1313
$encrypted = $script:un.CreateElement('encrypted', $script:nsm.LookupNamespace('un'))
14-
$listAttr = $script:un.CreateAttribute('config','type', $script:nsm.LookupNamespace('config'))
15-
$listAttr.InnerText = 'boolean'
16-
$null = $encrypted.Attributes.Append($listAttr)
14+
$boolAttr = $script:un.CreateAttribute('t')
15+
$boolAttr.InnerText = 'boolean'
16+
$null = $encrypted.Attributes.Append($boolAttr)
1717

1818
$encrypted.InnerText = 'false'
1919
$pw.InnerText = 'none'

0 commit comments

Comments
 (0)