]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Managing of packages to install
authorFrank Brehm <frank@brehm-online.com>
Fri, 24 Jun 2022 14:02:56 +0000 (16:02 +0200)
committerFrank Brehm <frank@brehm-online.com>
Fri, 24 Jun 2022 14:02:56 +0000 (16:02 +0200)
etc/cobbler-distros.yaml.default
lib/cr_vmware_tpl/config.py
templates/el-standard.ks

index 60bc9845b0c4358cb506ac72b53d832e17c65c94..14e0d72d4582125717807e8661123d2daddf66ee 100644 (file)
@@ -5,6 +5,42 @@ cobbler-distros:
     description: 'AlmaLinux 8 x86_64'
     shortname: 'alma8'
     ks_repo_url: 'https://repo02.pixelpark.com/Linux/yum/almalinux/8/BaseOS/x86_64/os'
+    packages:
+      - '@core'
+      - '@^minimal install'
+      - 'NetworkManager-config-server'
+      - 'bash-completion'
+      - 'bc'
+      - 'bind-utils'
+      - 'chrony'
+      - 'colordiff'
+      - 'curl'
+      - 'git'
+      - 'iotop'
+      - 'langpacks-de'
+      - 'lsof'
+      - 'mailx'
+      - 'man'
+      - 'mlocate'
+      - 'net-tools'
+      - 'p7zip'
+      - 'postfix'
+      - 'psmisc'
+      - 'puppet-agent'
+      - 'rsync'
+      - 'screen'
+      - 'strace'
+      - 'sysstat'
+      - 'tcpdump'
+      - 'telnet'
+      - 'tmux'
+      - 'traceroute'
+      - 'vim'
+      - 'wget'
+      - 'yum-utils'
+      - '-abrt*'
+      - '-nfs*'
+      - '-rpcbind'
     repos:
       - 'almalinux-8-x86_64-baseos'
       - 'almalinux-8-x86_64-appstream'
@@ -32,6 +68,39 @@ cobbler-distros:
       - 'pixelpark-el7-x86_64'
       - 'monitoring-noarch'
       - 'prometheus-el7-x86_64'
+    packages:
+      - '@base'
+      - 'bash-completion'
+      - 'bc'
+      - 'bind-utils'
+      - 'chrony'
+      - 'colordiff'
+      - 'curl'
+      - 'git'
+      - 'iotop'
+      - 'lsof'
+      - 'mailx'
+      - 'man'
+      - 'mlocate'
+      - 'net-tools'
+      - 'p7zip'
+      - 'postfix'
+      - 'psmisc'
+      - 'puppet-agent'
+      - 'rsync'
+      - 'screen'
+      - 'strace'
+      - 'sysstat'
+      - 'tcpdump'
+      - 'telnet'
+      - 'tmux'
+      - 'traceroute'
+      - 'vim'
+      - 'wget'
+      - 'yum-utils'
+      - '-mysql-community*'
+      - '-nfs*'
+      - '-rpcbind'
   centos-stream-8:
     distro: 'CentOS-Stream-8-x86_64'
     description: 'CentOS Stream 8 x86_64'
@@ -49,6 +118,42 @@ cobbler-distros:
       - 'pixelpark-el8-x86_64'
       - 'monitoring-noarch'
       - 'prometheus-el8-x86_64'
+    packages:
+      - '@core'
+      - '@^minimal install'
+      - 'NetworkManager-config-server'
+      - 'bash-completion'
+      - 'bc'
+      - 'bind-utils'
+      - 'chrony'
+      - 'colordiff'
+      - 'curl'
+      - 'git'
+      - 'iotop'
+      - 'langpacks-de'
+      - 'lsof'
+      - 'mailx'
+      - 'man'
+      - 'mlocate'
+      - 'net-tools'
+      - 'p7zip'
+      - 'postfix'
+      - 'psmisc'
+      - 'puppet-agent'
+      - 'rsync'
+      - 'screen'
+      - 'strace'
+      - 'sysstat'
+      - 'tcpdump'
+      - 'telnet'
+      - 'tmux'
+      - 'traceroute'
+      - 'vim'
+      - 'wget'
+      - 'yum-utils'
+      - '-abrt*'
+      - '-nfs*'
+      - '-rpcbind'
   oel-7:
     distro: 'Oracle-Linux-7.9-x86_64'
     description: 'Oracle Enterprise Linux 7 x86_64'
@@ -66,6 +171,40 @@ cobbler-distros:
       - 'pixelpark-el7-x86_64'
       - 'monitoring-noarch'
       - 'prometheus-el7-x86_64'
+    packages:
+      - '@base'
+      - 'bash-completion'
+      - 'bc'
+      - 'bind-utils'
+      - 'colordiff'
+      - 'chrony'
+      - 'curl'
+      - 'git'
+      - 'iotop'
+      - 'lsof'
+      - 'mailx'
+      - 'man'
+      - 'mlocate'
+      - 'net-tools'
+      - 'p7zip'
+      - 'postfix'
+      - 'psmisc'
+      - 'puppet-agent'
+      - 'rsync'
+      - 'screen'
+      - 'strace'
+      - 'sysstat'
+      - 'tcpdump'
+      - 'telnet'
+      - 'tmux'
+      - 'traceroute'
+      - 'vim'
+      - 'wget'
+      - 'yum-utils'
+      - '-mysql-community*'
+      - '-nfs*'
+      - '-rpcbind'
+      - '-*uek*'
   rocky-8:
     distro: 'Rocky-8.6-x86_64'
     description: 'Rocky Linux 8 x86_64'
@@ -83,6 +222,42 @@ cobbler-distros:
       - 'pixelpark-el8-x86_64'
       - 'monitoring-noarch'
       - 'prometheus-el8-x86_64'
+    packages:
+      - '@core'
+      - '@^minimal install'
+      - 'NetworkManager-config-server'
+      - 'bash-completion'
+      - 'bc'
+      - 'bind-utils'
+      - 'chrony'
+      - 'colordiff'
+      - 'curl'
+      - 'git'
+      - 'iotop'
+      - 'langpacks-de'
+      - 'lsof'
+      - 'mailx'
+      - 'man'
+      - 'mlocate'
+      - 'net-tools'
+      - 'p7zip'
+      - 'postfix'
+      - 'psmisc'
+      - 'puppet-agent'
+      - 'rsync'
+      - 'screen'
+      - 'strace'
+      - 'sysstat'
+      - 'tcpdump'
+      - 'telnet'
+      - 'tmux'
+      - 'traceroute'
+      - 'vim'
+      - 'wget'
+      - 'yum-utils'
+      - '-abrt*'
+      - '-nfs*'
+      - '-rpcbind'
 
 cobbler-repos:
   almalinux-8-x86_64-appstream:
index e3f160c4271958940bf84b460db726e65e393463..7ca8a040d051948abc1317bd2224314c92234c15 100644 (file)
@@ -31,7 +31,7 @@ from . import DEFAULT_CONFIG_DIR, DEFAULT_DISTRO_ARCH
 
 from .xlate import XLATOR
 
-__version__ = '1.9.3'
+__version__ = '1.9.4'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -58,7 +58,7 @@ class CobblerDistroInfo(FbGenericBaseObject):
     # -------------------------------------------------------------------------
     def __init__(
             self, name, shortname=None, distro=None, description=None, arch=DEFAULT_DISTRO_ARCH,
-            ks_repo_url=None, repos=None, snippets=None):
+            ks_repo_url=None, packages=None, repos=None, snippets=None):
 
         self._name = None
         self._shortname = None
@@ -66,6 +66,7 @@ class CobblerDistroInfo(FbGenericBaseObject):
         self._description = None
         self._arch = DEFAULT_DISTRO_ARCH
         self._ks_repo_url = None
+        self.packages = []
         self.repos = CIStringSet()
         self.snippets = CIStringSet()
 
@@ -75,9 +76,19 @@ class CobblerDistroInfo(FbGenericBaseObject):
         self.description = description
         self.arch = arch
 
+        if packages:
+            if is_sequence(packages):
+                for pkg in packages:
+                    if pkg not in packages:
+                        self.packages.append(pkg)
+            else:
+                msg = _("The given parameter {p!r} must be sequential type (given: {v!r}).")
+                raise TypeError(msg.format(p='packages', v=repos))
+
         if repos:
             if is_sequence(repos):
-                self.repos = copy.copy(repos)
+                for repo in repos:
+                    self.repos.add(snippet)
             else:
                 msg = _("The given parameter {p!r} must be sequential type (given: {v!r}).")
                 raise TypeError(msg.format(p='repos', v=repos))
@@ -85,6 +96,8 @@ class CobblerDistroInfo(FbGenericBaseObject):
         if snippets:
             if is_sequence(repos):
                 self.snippets = copy.copy(snippets)
+                for snippet in snippets:
+                    self.snippets.add(snippet)
             else:
                 msg = _("The given parameter {p!r} must be sequential type (given: {v!r}).")
                 raise TypeError(msg.format(p='snippets', v=snippets))
@@ -260,6 +273,9 @@ class CobblerDistroInfo(FbGenericBaseObject):
             self.name, shortname=self.shortname, distro=self.distro, arch=arch,
             ks_repo_url=self.ks_repo_url, description=self.description)
 
+        for package in self.packages:
+            new.packages.append(package)
+
         for repo in self.repos:
             new.repos.add(repo)
 
@@ -308,6 +324,17 @@ class CobblerDistroInfo(FbGenericBaseObject):
 
                 continue
 
+            if key.lower() == 'packages':
+                if is_sequence(value):
+                    for pkg in value:
+                        pkg = pkg.strip()
+                        if pkg != '' and pkg not in new.packages:
+                            new.packages.append(pkg)
+                elif value.strip() != '':
+                    new.packages.add(value.strip())
+
+                continue
+
             if key.lower() == 'snippets':
                 if is_sequence(value):
                     for snippet in value:
@@ -324,6 +351,10 @@ class CobblerDistroInfo(FbGenericBaseObject):
                     "Found unknown config parameter {p!r} with value {v!r} in configuration "
                     "of the Cobbler repository {r!r}.").format(p=key, v=value, r=name))
 
+        if verbose > 2:
+            msg = _("Found Cobbler repository configuration:") + '\n' + pp(new.as_dict())
+            LOG.debug(msg)
+
         return new
 
 
index b63f508f8760645be1a96e2ae98b6581762ebeca..f3ec695b981e8b19d598705d946ee58de397d801 100644 (file)
@@ -37,6 +37,9 @@ timezone  Europe/Berlin
 ###########################################
 # Partitioning and Disk
 
+# Clear the Master Boot Record
+zerombr
+
 # System bootloader configuration
 bootloader --location=mbr --append="net.ifnames=0 biosdevname=0"
 
@@ -54,6 +57,93 @@ logvol  /var      --vgname=vgroot --name=var  --size=4096 --grow
 logvol  /var/log  --vgname=vgroot --name=log  --size=2048
 
 ##########################################
-# Repositories
+# Packages
+
+%packages
+{%- for package in distro.packages %}
+{{ package }}
+{%- endfor %}
+%end
+
+##########################################
+# Post installation tasks in chroot env
+
+%post --interpreter=/usr/bin/bash
+
+### output to console
+mkdir -p "/var/log/anaconda"
+clear
+POST_LOG="/var/log/anaconda/post-install.log"
+exec < /dev/console &> >(tee -a "$POST_LOG")
+
+######################################################################################
+# Installation of pixelpark standard applications
+######################################################################################
+
+
+### debug
+# set -x
+
+echo "cobbler profile = $profile_name"
+
+echo
+echo "IP interfaces"
+ip link show
+
+echo
+echo "IP addresses"
+ip address show
+
+echo
+echo "IPv4 routes"
+ip route list
+
+echo
+echo "IPv6 routes"
+ip -6 route list
+
+echo
+echo "/etc/resolv.conf"
+cat /etc/resolv.conf
+
+if [[ -d "/etc/yum.repos.d" ]] ; then
+
+    echo
+    echo "/etc/yum.repos.d/"
+    ls -lA /etc/yum.repos.d
+
+    for repo_file in /etc/yum.repos.d/*.repo ; do
+        if [[ -f "${repo_file}" ]] ; then
+            echo
+            echo "${repo_file}"
+            echo '---'
+            cat "${repo_file}"
+            echo '---'
+        fi
+    done
+
+fi
+
+
+### remove unnecessary directory
+rm -rf /var/var
+
+export hostname="$hostname"
+export system_name="$system_name"
+export gateway="$gateway"
+export mgmt_interface="eth0"
+export ip_address_eth0="$ip_address_eth0"
+export mac_address_eth0="$mac_address_eth0"
+export system_status="${SYSTEM_STATUS}"
+export ws_rel_filesdir="${WS_REL_FILESDIR}"
 
+echo
+echo "hostname:             '$hostname'"
+echo "system_name:          '$system_name'"
+echo "gateway:              '$gateway'"
+echo "Management interface: '${mgmt_interface}'"
+echo "ip_address_eth0:      '$ip_address_eth0'"
+echo "mac_address_eth0:     '$mac_address_eth0'"
+echo "System status:        '${system_status}'"
 
+%end