From: Frank Brehm Date: Tue, 15 Aug 2023 15:52:53 +0000 (+0200) Subject: Addig stuff for RHEL 9.2 X-Git-Tag: 3.0.0^2~47 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=559374bb636fa0834460483c325ec93c2325e740;p=pixelpark%2Fcreate-vmware-tpl.git Addig stuff for RHEL 9.2 --- diff --git a/kickstart/profile.rhel-9.2.develop.ks b/kickstart/profile.rhel-9.2.develop.ks new file mode 100644 index 0000000..e363b2f --- /dev/null +++ b/kickstart/profile.rhel-9.2.develop.ks @@ -0,0 +1,295 @@ +###################################################################################### +# Provisioning-Installation of edHat Enterprise Linux 9.2 +###################################################################################### +# +# Standard Pixelpark Installation of rhel-9.2 templates. +# + +# lang en_US +# keyboard --xlayouts='de(nodeadkeys)' +# timezone Europe/Berlin --utc +# rootpw $2b$10$BOX9s/mftn9mQwhFQ2bo2ucXnvYSQ7sOKk5wna7E0eMj40hFd.rx6 --iscrypted +# text +# url --url=https://test-cobbler01.pixelpark.com/cobbler/distro_mirror/RHEL-9.2/BaseOS +# bootloader --append="rhgb quiet crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M" +# zerombr +# clearpart --all --initlabel +# volgroup vgroot --pesize=4096 pv.0 +# part pv.0 --fstype=lvmpv --ondisk=sdb --size=20480 +# part /boot --fstype=ext4 --ondisk=sda --size=512 --asprimary +# logvol / --vgname=vgroot --name=root --fstype=xfs --size=6144 +# logvol /var --vgname=vgroot --name=var --fstype=xfs --size=1 --grow --maxsize=20480 +# logvol /home --vgname=vgroot --name=home --fstype=xfs --size=1024 +# logvol swap --vgname=vgroot --name=swap --fstype=swap --size=1024 +# logvol /opt --vgname=vgroot --name=opt --fstype=xfs --size=2048 +# network --bootproto=dhcp +# skipx +# firstboot --disable +# selinux --permissive +# %pre --interpreter=/bin/bash +# echo "Hier get's los ..." +# %end +# %post --interpreter=/bin/bash +# echo "Und hier endet es." +# %end +# %packages +# @^minimal-environment +# kexec-tools +# %end + +# Firewall configuration +firewall --disabled + +# Use network installation from cobbler host +# url --url="https://test-cobbler01.pixelpark.com/cobbler/distro_mirror/RHEL-9.2" --noverifyssl +url --url="http://${server}/cobbler/distro_mirror/RHEL-9.2" + +sshpw --username=inst testtest --plaintext + +# Root install-password +rootpw --iscrypted ${ROOT_PWD_HASH} +# System authorization information +# auth --useshadow --passalgo=sha512 +authselect select sssd with-mkhomedir with-sudo + +# Use text mode install +text +# System keyboard +keyboard --vckeymap=de-deadacute +# System language +lang en_US +# SELinux configuration +selinux --permissiv +# Do not configure the X Window System +skipx + +# Installation logging level +# logging --level=debug + +# Reboot after installation +reboot +# firstboot --disable + +# System timezone +timezone Europe/Berlin + +########################################### +# Partitioning and Disk + +# Clear the Master Boot Record +zerombr + +# System bootloader configuration +bootloader --location=mbr --append="net.ifnames=0 biosdevname=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M" + +# Network done by DHCP +# network --bootproto=dhcp +# network --bootproto=static --ip=192.168.145.50 --netmask=255.255.255.0 --gateway=192.168.145.1 +network --bootproto=static --ip=${ip_address_eth0} --netmask=${netmask_eth0} --gateway=${if_gateway_eth0} + +# Partition clearing information +clearpart --drives=sda --initlabel --all + +# Disk partitioning information +part /boot --fstype ext4 --size=512 --ondisk=sda --asprimary +part pv.01 --size=1 --grow --ondisk=sda +volgroup vgroot pv.01 +logvol / --vgname=vgroot --name=root --fstype=xfs --size=6144 +logvol swap --vgname=vgroot --name=swap --fstype=swap --size=1024 +logvol /home --vgname=vgroot --name=home --fstype=xfs --size=1024 +logvol /var --vgname=vgroot --name=var --fstype=xfs --size=4096 --grow +logvol /var/log --vgname=vgroot --name=log --fstype=xfs --size=2048 + +########################################## +# Repositories + +repo --name=baseos --install --noverifyssl --baseurl=https://test-cobbler01.pixelpark.com/cobbler/distro_mirror/RHEL-9.2/BaseOS +repo --name=appstream --install --noverifyssl --baseurl=https://test-cobbler01.pixelpark.com/cobbler/distro_mirror/RHEL-9.2/AppStream +repo --name=pixelpark --install --noverifyssl --baseurl=https://repo02.pixelpark.com/Linux/yum/pixelpark/9/ +repo --name=puppet --install --noverifyssl --baseurl=https://repo02.pixelpark.com/Linux/yum/puppetlabs/puppet7/el/8/x86_64 + +########################################## +# Packages + +%packages +@core +@^minimal install +NetworkManager-config-server +bash-completion +bc +bind-utils +chrony +curl +git +iotop +kexec-tools +langpacks-de +lsof +man +mlocate +net-tools +postfix +psmisc +rsync +strace +sysstat +tcpdump +telnet +tmux +traceroute +vim +wget +yum-utils +-abrt* +-nfs* +-rpcbind +%end + +########################################## +# Pre tasks +# %pre --interpreter=/bin/bash --log=/var/log/ks-pre.log +%pre --interpreter=/bin/bash --log=/var/log/ks-pre.log +#raw +echo "[$( date --rfc-3339=seconds )]: Hier get's los ..." +#end raw +%end + +########################################## +# Pre installation tasks +%pre-install --interpreter=/bin/bash --log=/var/log/ks-pre-install.log +#raw +echo "[$( date --rfc-3339=seconds )]: Aber nu erst ..." +#end raw +%end + +########################################## +# Post installation tasks in chroot env + +%post --interpreter=/usr/bin/bash + +### output to console +mkdir -p -v "/var/log/anaconda" +clear +POST_LOG="/var/log/anaconda/post-install.log" +exec < /dev/console &> >(tee -a "$POST_LOG") + +###################################################################################### +# Installation of pixelpark standard applications +###################################################################################### + +#raw +echo "[$( date --rfc-3339=seconds )]: Start postinstallation tasks:" +#end raw + +### 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 -rfv /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 netmask_eth0="${netmask_eth0}" +export if_gateway_eth0="${if_gateway_eth0}" +export mac_address_eth0="$mac_address_eth0" +export system_status="${SYSTEM_STATUS}" +export ws_rel_filesdir="${WS_REL_FILESDIR}" +export cobbler_url="${COBBLER_URL}" + +#raw +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 "Netmask eth0: '${netmask_eth0}'" +echo "Gateway eth0: '${if_gateway_eth0}'" +echo "MAC address eth0: '${mac_address_eth0}'" +echo "System status: '${system_status}'" +echo "Ws relative filesdir: '${ws_rel_filesdir}'" +echo "Cobbler URL: '${cobbler_url}'" +#end raw + +############################################################################### +# Performing snippets + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.001.basics.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.010.authkeys.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.040.network.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.060.tweak_systemd.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.070.tweak_grub.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.075.tmp-tmpfs.sh" +echo +echo "Using snippet $this_snippet" +$SNIPPET($this_snippet) + +# ########################### +# Seems to be finished + +%end + diff --git a/snippets/tpl.001.basics.sh b/snippets/tpl.001.basics.sh index 861f6d4..ccde790 100644 --- a/snippets/tpl.001.basics.sh +++ b/snippets/tpl.001.basics.sh @@ -10,6 +10,8 @@ if [[ -z "${hostname}" ]] ; then hostname="template.pixelpark.com" fi +export base_hostname=$( echo "${hostname}" | sed -e 's/\..*//' ) + DEVNAME_ETH0=$( ip -oneline link show | \ grep -v ' lo: ' | \ head -n 1 | \ @@ -99,6 +101,7 @@ ERROR_POINTER="/root/postinst-error.txt" echo echo "Some information:" echo " \$hostname: $hostname" +echo " \$base_hostname: $base_hostname" echo " \$system_name: $system_name" echo " \$gateway: $gateway" echo " \$management_interface: ${mgmt_interface}" diff --git a/snippets/tpl.040.network.sh b/snippets/tpl.040.network.sh index 82c1d43..a6cd1d2 100644 --- a/snippets/tpl.040.network.sh +++ b/snippets/tpl.040.network.sh @@ -34,7 +34,16 @@ create_networkconfig() { echo # Also set the hostname now, some applications require it - /bin/hostname "${hostname}" + echo "Generating '/etc/hostname' ..." + /bin/hostname "${base_hostname}" + echo "${base_hostname}" > '/etc/hostname' + + echo "Updating '/etc/hosts' ..." + echo >>'/etc/hosts' + echo "${ip_address_eth0} ${hostname} ${base_hostname}" >>'/etc/hosts' + echo "Generated /etc/hosts:" + cat '/etc/hosts' | true + echo local dev_file="${tmp_nw_script_dir}/ifcfg-${mgmt_interface}" echo "Generating '${dev_file}' ..." @@ -69,7 +78,7 @@ create_networkconfig() { echo "DOMAIN=\"${search}\"" >>"${dev_file}" fi - echo "RES_OPTIONS=\"timeout:1 attempts:2 use-vc\"" >>"${dev_file}" + echo "RES_OPTIONS=\"timeout:1 attempts:2\"" >>"${dev_file}" echo >>"${dev_file}" for ifcfg_file in ${nw_script_dir}/ifcfg-* ; do