Autoyast

automatische Installation von Suserechnern.

tftp

von DVD die Dateien linux und initrd ins tftp-verzeichnis kopieren.
DVD und autoyastdatei per apache freigegeben.
für UEFI in grub.cfg eintragen:

##### Leap 15.4
menuentry 'Install Leap 15.4 automatic' --class opensuse --class gnu-linux --class os{
set gfxpayload=keep
echo 'Loading kernel /srv/tftp/boot/x86_64/loader/leap.15.4.linux ...'
linuxefi /boot/x86_64/loader/leap_15.4.linux splash=silent install=http://meinwebserver/suse/leap/15.4/dvd autoyast=http://meinwebserver/suse/profiles/leap15.4_default.xml showopts insecure=1   BrokenModules=nouveau nomodeset self_update=1
echo 'Loading initial ramdisk /srv/tftp/boot/x86_64/loader/leap_15.4.initrd ...'
initrdefi /boot/x86_64/loader/leap_15.4.initrd
}
#####

autoyast

Datei: leap15.4_default.xml

<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<add-on t="map">
  <add_on_others t="list">
      <listentry t="map">
          <alias>OPENSUSE_15.4_DVD</alias>
          <media_url>http://meinwebserver/suse/leap/15.4/dvd/</media_url>
          <name>Standard DVD von Opensuse 15.4</name>
          <priority t="integer">99</priority>
          <product_dir>/</product_dir>
       </listentry>
       <listentry t="map">
               <alias>meine_Programme</alias>
              <media_url>http://meinwebserver/suse/my_progs/</media_url>
              <priority t="integer">99</priority>
              <product_dir>/</product_dir>
              <name>meine_Programme</name>
       </listentry>
       <listentry>
              <media_url>http://meinwebserver/suse/update/leap/15.4/sle/</media_url>
              <alias>Suse-Leap-15.4_Updates_sle</alias>
              <product>Suse-Leap-15.4_Updates_sle</product>
              <product_dir>/</product_dir>
              <name>Suse-Leap-15.4_Updates_sle</name>
       </listentry>
       <listentry>
              <media_url>http://meinwebserver/suse/update/leap/15.4/oss/</media_url>
              <alias>Suse-Leap-15.4_Updates_oss</alias>
              <product>Suse-Leap-15.4_Updates_oss</product>
              <product_dir>/</product_dir>
              <name>Suse-Leap-15.4_Updates_oss</name>
       </listentry>
       <listentry>
              <media_url>http://meinwebserver/suse/leap/15.4/repo/oss/</media_url>
              <product>Suse-Leap-15.4_oss</product>
              <product_dir>/</product_dir>
              <name>Suse-Leap-15.4_oss</name>
       </listentry>
       <listentry>
               <media_url>http://meinwebserver/suse/update/leap/15.4/non-oss/</media_url>
               <product>Suse-Leap15.4_Updates_non-oss</product>
               <product_dir>/</product_dir>
               <name>Suse-Leap15.4_Updates_non-oss</name>
       </listentry>
      <listentry t="map">
          <alias>NVIDIA_OPENSUSE_15.4</alias>
          <media_url>http://meinwebserver/suse/video/nvidia/15.4</media_url>
          <name>NVIDIA_for_Opensuse 15.4</name>
          <priority t="integer">99</priority>
          <product_dir>/</product_dir>
      </listentry>
  </add_on_others>
</add-on>
<general>
 <self_update config:type="boolean">true</self_update>
  <signature-handling>
    <accept_file_without_checksum t="boolean">true</accept_file_without_checksum>
    <accept_non_trusted_gpg_key t="boolean">true</accept_non_trusted_gpg_key>
    <accept_unknown_gpg_key t="boolean">true</accept_unknown_gpg_key>
    <accept_unsigned_file t="boolean">true</accept_unsigned_file>
    <accept_verification_failed t="boolean">true</accept_verification_failed>
    <import_gpg_key t="boolean">true</import_gpg_key>
  </signature-handling>
<mode>
  <confirm config:type="boolean">false</confirm>
</mode>
<ask-list t="list">
  <ask>
      <pathlist config:type="list">
       <path>networking,dns,hostname</path>
       </pathlist>
       <question>Enter Hostname eg. notebook1234</question>
       <stage>initial</stage>
       <default>notebook1234</default>
  </ask>
  </ask-list>
</general>
<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
</networking>
<ntp-client t="map">
  <ntp_policy>auto</ntp_policy>
  <ntp_servers t="list">
    <ntp_server t="map">
      <address>10.11.12.13</address>
      <iburst t="boolean">true</iburst>
      <offline t="boolean">false</offline>
    </ntp_server>
  </ntp_servers>
  <ntp_sync>systemd</ntp_sync>
</ntp-client>
<software t="map">
  <install_recommended t="boolean">true</install_recommended>
<instsource/>
<packages t="list">
  <package>mc</package>
  <package>wicked</package>
  <package>xrdp</package>
  <package>net-tools-deprecated</package>
  <package>krb5-client</package>
  <package>samba-client</package>
<!--    <package>ICAClient</package>
  <package>teams</package>
-->
</packages>

<!– Onlinerepos deaktivieren –>

<remove-packages config:type="list">
  <package>openSUSE-release</package>
</remove-packages>
 <patterns t="list">
  <pattern>base</pattern>
  <pattern>minimal_base</pattern>
  <pattern>basesystem</pattern>
  <pattern>enhanced_base</pattern>
  <pattern>x11</pattern>
  <pattern>sw_management</pattern>
  <pattern>x11_enhanced</pattern>
  <pattern>kde</pattern>
  <pattern>kde_yast</pattern>
  <pattern>kde_internet</pattern>
  <pattern>kde_plasma</pattern>
  <pattern>kde_office</pattern>
  <pattern>kde_multimedia</pattern>
  <pattern>yast2_basis</pattern>
  <pattern>yast2_desktop</pattern>
 </patterns>
  <products t="list">
      <product>Leap</product>
  </products>
</software>
<groups t="list">
  <group t="map">
    <gid>473</gid>
    <groupname>wheel</groupname>
    <userlist>doedel,muser</userlist>
  </group>
  <group t="map">
    <gid>0</gid>
    <groupname>root</groupname>
    <userlist/>
  </group>
</groups>

<users config:type=„list“>

 <user>
    <encrypted config:type="boolean">true</encrypted>
    <fullname>root</fullname>
    <gid>0</gid>
    <home>/root</home>
    <password_settings>
      <expire/>
      <flag/>
      <inact/>
      <max/>
      <min/>
      <warn/>
    </password_settings>
    <shell>/bin/bash</shell>
    <uid>0</uid>
    <user_password>$6$/vGOh.r8q4tchyit$gE/TSOKVsTotcf9vfRJV0s4yd2yGgOSX/92my/yV6uKP7yGfIm8qdjAOo6NYEEDTPCO2IQ4rBw.Y57Qdje1TS/</user_password>
    <username>root</username>
  </user>
  <user t="map">
    <encrypted t="boolean">true</encrypted>
    <fullname>my user</fullname>
<!--      <gid>100</gid>
    <home>/home/muser</home>
    <password_settings>
      <expire/>
      <flag/>
      <inact/>
      <max/>
      <min/>
      <warn/>
    </password_settings>
    <shell>/bin/bash</shell>
    <uid>1000</uid>
-->
    <user_password>$6$8R5uuhbROrAXmZLu$/Tuia.MlcUnzW0ACWIeu9nJqFGyas.q5ZdZkwgKPSfihq8iiJMY1D7RNufCR9QPjJFeSlYCcBAysndrJYS1PG4</user_password>
    <username>muser</username>
  </user>
</users>
<scripts>
 <post-scripts config:type="list">
  <script>
  <filename>postexec.sh</filename>
  <interpreter>shell</interpreter>
  <location/>
  <feedback config:type="boolean">false</feedback>
  <source><![CDATA[#!/bin/sh
  echo running zypper
  mv /var/run/zypp.pid /var/run/zypp.sav
  zypper rr repo-sle-update
  zypper rr repo-sle-debug-update
  zypper rr repo-backports-update
  zypper rr repo-backports-debug-update
  ### ab opensuse 15.5 löschen von reposervices
  zypper rs openSUSE
  zypper rs NVIDIA
  zypper ref
  # zypper up
  yast2 sound add all
  #yast2 proxy disable
  mv /var/run/zypp.sav /var/run/zypp.pid
  ]]></source>
 </script>
</post-scripts>
</scripts>
<keyboard>
  <keymap>german</keymap>
</keyboard>
<language>
  <language>de_DE</language>
  <languages>de_DE</languages>
</language>
<!--
<sound>
<autoinstall config:type="boolean">true</autoinstall>
<configure_detected config:type="boolean">true</configure_detected>
</sound>
-->
<proxy>
<enabled config:type="boolean">false</enabled>
<ftp_proxy>http://myproxy:8080</ftp_proxy>
<http_proxy>http://myproxy:8080</http_proxy>
<no_proxy>.my.dom.ain localhost suserep</no_proxy>
<proxy_password>testpw</proxy_password>
<proxy_user>testuser</proxy_user>
</proxy>
<bootloader t="map">
  <global t="map">
    <append>splash=silent insmod=e1000e* nomodeset preempt=full mitigations=auto quiet security=apparmor</append>
    <cpu_mitigations>auto</cpu_mitigations>
    <gfxmode>auto</gfxmode>
    <hiddenmenu>false</hiddenmenu>
    <os_prober>true</os_prober>
    <secure_boot>true</secure_boot>
    <terminal>gfxterm</terminal>
    <timeout t="integer">8</timeout>
    <update_nvram>true</update_nvram>
    <xen_kernel_append>vga=gfx-1024x768x16</xen_kernel_append>
  </global>
  <loader_type>grub2-efi</loader_type>
</bootloader>
<!-- Partitionierung fuer UEFI -->
<partitioning config:type="list">
  <drive>
    <device>/dev/sda</device>
    <disklabel>gpt</disklabel>
    <enable_snapshots config:type="boolean">true</enable_snapshots>
    <initialize config:type="boolean">true</initialize>
    <partitions config:type="list">
      <partition>
        <create config:type="boolean">true</create>
        <label>efi</label>
        <partition_id config:type="integer">263</partition_id>
        <partition_nr config:type="integer">1</partition_nr>
        <resize config:type="boolean">false</resize>
        <size>516062720</size>
      </partition>
      <partition>
        <create config:type="boolean">true</create>
        <crypt_fs config:type="boolean">false</crypt_fs>
        <filesystem config:type="symbol">swap</filesystem>
        <format config:type="boolean">true</format>
        <fstopt>defaults</fstopt>
        <loop_fs config:type="boolean">false</loop_fs>
        <mount>swap</mount>
        <mountby config:type="symbol">uuid</mountby>
        <partition_id config:type="integer">130</partition_id>
        <partition_nr config:type="integer">2</partition_nr>
        <resize config:type="boolean">false</resize>
        <size>17171643904</size>
      </partition>
      <partition>
        <create config:type="boolean">true</create>
        <crypt_fs config:type="boolean">false</crypt_fs>
        <filesystem config:type="symbol">vfat</filesystem>
        <format config:type="boolean">true</format>
        <fstopt>umask=0002,utf8=true</fstopt>
        <loop_fs config:type="boolean">false</loop_fs>
        <mount>/boot/efi</mount>
        <mountby config:type="symbol">uuid</mountby>
        <partition_id config:type="integer">259</partition_id>
        <partition_nr config:type="integer">3</partition_nr>
        <resize config:type="boolean">false</resize>
        <size>160595456</size>
      </partition>
      <partition>
        <create config:type="boolean">true</create>
        <crypt_fs config:type="boolean">false</crypt_fs>
        <filesystem config:type="symbol">ext4</filesystem>
        <format config:type="boolean">true</format>
        <fstopt>defaults</fstopt>
        <loop_fs config:type="boolean">false</loop_fs>
        <mount>/</mount>
        <mountby config:type="symbol">uuid</mountby>
        <partition_id config:type="integer">131</partition_id>
        <partition_nr config:type="integer">4</partition_nr>
        <resize config:type="boolean">false</resize>
        <size>max</size>
      </partition>
     </partitions>
    <pesize/>
    <type config:type="symbol">CT_DISK</type>
    <use>all</use>
  </drive>
 </partitioning>
  <firewall t="map">
    <enable_firewall t="boolean">false</enable_firewall>
    <start_firewall t="boolean">false</start_firewall>
  </firewall>
  <services-manager t="map">
    <default_target>graphical</default_target>
    <services>
      <enable t="list">
          <service>display-manager</service>
          <service>xrdp</service>
      </enable>
    </services>
  </services-manager>
</profile>

grub2 erweitern

es sollen Rechner entsprechend ihrer macadresse erkannt und dann installiert werden.
Beispiel: der Rechner meinhost mit der MAC 11:22:33:44:55:66 soll mit Opensuse Leap 15.5 automatisch installiert werden.
Dazu muss die /srv/tftp/grub.cfg erweitert und eine Datei entsprechend ihrer MAC erstellt werden.
die grub.cfg merged sich mit der MAC-Datei und zeigt den Menüeintrag nur an wenn die MAC-Datei für den Client auch existiert.
die SUSE-Profildatei muss vorher so angepasst werden, dass der hostname auch übernommen und der Rechner somit installiert wird.
nur getestet mit der Uefi-Datei für PXE für SLE; andere Versionen haben evtl. Probleme damit.
Wenn das erfolgreich getestet wurde brauchen die MAC-dateien nur entsprechend kopiert und angepasst werden.

mkdir /srv/tftp/uefi_clients
echo "pxe_client=meinhost" >>/srv/tftp/uefi_clients/11:22:33:44:55:66
echo "os_version=15.5" >>/srv/tftp/uefi_clients/11:22:33:44:55:66
chown -R tftp /srv/tftp/uefi_clients

In der grub.cfg folgende Zeilen oben eintragen:

source $prefix/uefi_clients/$net_default_mac
default=0
##################
# 192.168.10.10 ist hier der PXE- und Repowebserver mit gemountetem DVD-ISO
# Diesen Installationseintrag nur anzeigen wenn Variable $pxe_client in o.g. MAC-Datei vorher definiert ist.
# sonst ist das Menü sinnlos
if [ "$pxe_client" != "" ] ; then
  menuentry "Install Leap $os_version automatic MINIMAL for $pxe_client $net_default_mac" --class opensuse --class gnu-linux --class os{
  set gfxpayload=keep
  echo "Loading kernel  (http,192.168.10.10)/suse/leap/$os_version/dvd/boot/x86_64/loader/linux"
  linuxefi (http,192.168.10.10)/suse/leap/$os_version/dvd/boot/x86_64/loader/linux hostname=$pxe_client install=http://mywebsrv/suse/leap/"$os_version"/dvd autoyast=http://mywebsrv/suse/profiles/leap"$os_version"_automatic.xml showopts insecure=1 BrokenModules=nouveau self_update=1
  echo "Loading ramdisk  (http,192.168.10.10)/suse/leap/$os_version/dvd/boot/x86_64/loader/initrd"
  initrdefi (http,192.168.10.10)/suse/leap/$os_version/dvd/boot/x86_64/loader/initrd
  }
  menuentry '---------------------------------------------' {
  true
  }
  fi
##################