]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Setting COBBLER_URL as a kickstart parameter.
authorFrank Brehm <frank@brehm-online.com>
Mon, 4 Jul 2022 15:22:45 +0000 (17:22 +0200)
committerFrank Brehm <frank@brehm-online.com>
Mon, 4 Jul 2022 15:22:45 +0000 (17:22 +0200)
26 files changed:
snippets/tpl.001.basics.sh
snippets/tpl.010.authkeys.sh
snippets/tpl.040.network.sh
snippets/tpl.080.rsyslogd-el7.sh
snippets/tpl.080.rsyslogd-el8.sh
snippets/tpl.170.repos_centos7.sh
snippets/tpl.170.repos_oel7.sh
snippets/tpl.175.repos_el7.sh
snippets/tpl.180.repos_almalinux8.sh
snippets/tpl.180.repos_centos8.sh
snippets/tpl.180.repos_rocky8.sh
snippets/tpl.185.repos_el8.sh
snippets/tpl.190.repos_almalinux9.sh
snippets/tpl.190.repos_centos9.sh
snippets/tpl.195.repos_el9.sh
snippets/tpl.205.bashrc-el7.sh
snippets/tpl.210.bashrc-el8.sh
snippets/tpl.211.bashrc-el9.sh
snippets/tpl.225.vimrc-el7.sh
snippets/tpl.230.vimrc-el8.sh
snippets/tpl.231.vimrc-el9.sh
snippets/tpl.300.create-motd.sh
snippets/tpl.350.legato.sh
snippets/tpl.470.postfix.sh
snippets/tpl.500.logrotate.sh
templates/el-standard.ks

index 09e310c9067fea946f4e6ce9d4341f0fc307b441..861f6d4ec32c559d02ee53a13377a05464c2d4a1 100644 (file)
@@ -2,7 +2,6 @@
 #raw
 
 HASH_LINE="#######################################################################################"
-COBBLER_URL="http://cobbler.pixelpark.com"
 
 echo "$(date --rfc-3339=seconds): Das ist das Post-Install-Script '$0'."
 echo
@@ -16,11 +15,64 @@ DEVNAME_ETH0=$( ip -oneline link show | \
                 head -n 1 | \
                 awk '{print $2}' | \
                 sed -e 's/:$//' )
+
 IP_ADDRESS_ETH0=$( ip -oneline addr show dev "${DEVNAME_ETH0}" | \
                    grep ' inet ' | \
                    head -n 1 | \
                    awk '{print $4}' | \
                    sed -e 's|/.*||' )
+
+NETMASK_INT_ETH0=$( ip -oneline addr show dev "${DEVNAME_ETH0}" | \
+                   grep ' inet ' | \
+                   head -n 1 | \
+                   awk '{print $4}' | \
+                   sed -e 's|.*/||' )
+
+case "${NETMASK_INT_ETH0}" in
+    20)
+        NETMASK_ETH0='255.255.240.0'
+        ;;
+    21)
+        NETMASK_ETH0='255.255.248.0'
+        ;;
+    22)
+        NETMASK_ETH0='255.255.252.0'
+        ;;
+    23)
+        NETMASK_ETH0='255.255.254.0'
+        ;;
+    24)
+        NETMASK_ETH0='255.255.255.0'
+        ;;
+    25)
+        NETMASK_ETH0='255.255.255.128'
+        ;;
+    26)
+        NETMASK_ETH0='255.255.255.192'
+        ;;
+    27)
+        NETMASK_ETH0='255.255.255.224'
+        ;;
+    28)
+        NETMASK_ETH0='255.255.255.240'
+        ;;
+    29)
+        NETMASK_ETH0='255.255.255.248'
+        ;;
+    30)
+        NETMASK_ETH0='255.255.255.252'
+        ;;
+    31)
+        NETMASK_ETH0='255.255.255.254'
+        ;;
+    32)
+        NETMASK_ETH0='255.255.255.255'
+        ;;
+    *)
+        NETMASK_ETH0='255.255.255.255'
+        ;;
+esac
+
 GATEWAY=$( ip -oneline route show | grep ^default | head -n 1 | awk '{print $3}' )
 DOMAIN=$( echo "${hostname}" | sed -e 's/^[^\.]*\.//' )
 SIMPLE_HOSTNAME=$( echo "${hostname}" | sed -e 's/\..*//' )
@@ -53,8 +105,11 @@ echo "  \$management_interface: ${mgmt_interface}"
 echo "  \$mac_address_eth0:     $mac_address_eth0"
 echo "  \$ip_address_eth0:      $ip_address_eth0"
 echo "  \$IP_ADDRESS_ETH0:      $IP_ADDRESS_ETH0"
+echo "  \$NETMASK_INT_ETH0:     $NETMASK_INT_ETH0"
+echo "  \$NETMASK_ETH0:         $NETMASK_ETH0"
 echo "  \$SIMPLE_HOSTNAME:      $SIMPLE_HOSTNAME"
 echo "  \$DOMAIN:               $DOMAIN"
+echo "  \$cobbler_url:          $cobbler_url"
 
 #-----------------------------------------------------------
 log() {
index 387ce5fbe2c5dad5f3106aa92e32b40909553308..cafb3ff93026d773c108f9f9f817f5a423a3de2b 100644 (file)
@@ -9,7 +9,7 @@ create_authkeys() {
     echo "${HASH_LINE}"
     echo "Calling create_authkeys() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/keys/auth_keys_pp_betrieb"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/keys/auth_keys_pp_betrieb"
 
     log "Creating /root/.ssh ..."
     mkdir -pv /root/.ssh
index 12ea0fe71b2f2c99204f4b61f9af913bc1827fa1..82c1d43d91f77480a63c3a1134ac7f94c7b0df17 100644 (file)
@@ -46,10 +46,32 @@ create_networkconfig() {
        NETBOOT=yes
        UUID="${if_uuid}"
        IPV6INIT=yes
-       BOOTPROTO=dhcp
+       BOOTPROTO=none
        TYPE=Ethernet
+       USERCTL=no
+       IPADDR=${IP_ADDRESS_ETH0}
+       NETMASK=${NETMASK_ETH0}
+       PREFIX=${NETMASK_INT_ETH0}
+       IPV4_FAILURE_FATAL=no
+       PEERDNS=no
        EOF
 
+    local i=1
+    local ns=
+
+    for ns in $( cat /etc/resolv.conf | grep '^nameserver' | awk '{print $2}' ) ; do
+        echo "DNS${i}=${ns}" >>"${dev_file}"
+        i=$(( $i + 1 ))
+    done
+
+    if grep '^search' /etc/resolv.conf >/dev/null ; then
+        local search=$( grep '^search' /etc/resolv.conf | sed -e 's/^search[   ][      ]*//' )
+        echo "DOMAIN=\"${search}\"" >>"${dev_file}"
+    fi
+
+    echo "RES_OPTIONS=\"timeout:1 attempts:2 use-vc\"" >>"${dev_file}"
+    echo >>"${dev_file}"
+
     for ifcfg_file in ${nw_script_dir}/ifcfg-* ; do
         local bname=$(basename "${ifcfg_file}" )
         if [[ "${bname}" == "ifcfg-lo" ]] ; then
index 7e4bb6a79e71f83bbcb84fb0e550a1d61e4d4d2a..11e9a38950fbee4d356af1a9480dccaaf6da1696 100644 (file)
@@ -9,8 +9,8 @@ set_rsyslogd_el7() {
     echo "${HASH_LINE}"
     echo "Calling set_rsyslogd_el7() ..."
     echo
-    local url_top="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/rsyslog.conf"
-    local url_sub="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el7"
+    local url_top="${cobbler_url}/${ws_rel_filesdir}/${system_status}/rsyslog.conf"
+    local url_sub="${cobbler_url}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el7"
 
     echo
     log "Configuring Rsyslogd."
index 90dfb2ce9e67c54f3d64cda9eabf4aa7839f84ee..5d2ca47a16d4d4f3e1c68e6f8c3c1f019b492b95 100644 (file)
@@ -9,8 +9,8 @@ set_rsyslogd_el8() {
     echo "${HASH_LINE}"
     echo "Calling set_rsyslogd_el8() ..."
     echo
-    local url_top="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/rsyslog.conf"
-    local url_sub="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el8"
+    local url_top="${cobbler_url}/${ws_rel_filesdir}/${system_status}/rsyslog.conf"
+    local url_sub="${cobbler_url}/${ws_rel_filesdir}/${system_status}/50_rsyslog.conf.el8"
 
     echo
     log "Configuring Rsyslogd."
index 51baddf21dfa6baa2525c74326e9a22583bc27d0..d1368c92a445ad6719f0698a9b33267ef660f31e 100644 (file)
@@ -9,7 +9,7 @@ get_repos_centos7() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_centos7() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos7"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/centos7"
 
     local -a repos=('CentOS-Base' 'CentOS-CR' 'CentOS-fasttrack')
 
index 3b1dcadfc437c44638044506452669c49cca35b6..838c7c5a74d899769adf9b09515b4b03c453686f 100644 (file)
@@ -9,7 +9,7 @@ get_repos_oel7() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_oel7() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/oel7"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/oel7"
 
     local -a repos=('ol7_addons' 'ol7_latest' 'ol7_optional_latest')
 
index 48ab4a174529c26151aa010b54e52dffd783be84..beb62a9026ec40fa5b1d5bc2821f683e5ed02921 100644 (file)
@@ -9,7 +9,7 @@ get_repos_el7() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_el7() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/el7"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/el7"
 
     local -a repos=('epel' 'icinga' 'pixelpark' 'prometheus' 'puppet' 'wazuh')
 
index 5c8db9622af5b2530537f03fa3bc1c6310ac2337..8c7029de354032a280c922ed8511c0ee628e57dc 100644 (file)
@@ -8,7 +8,7 @@ get_repos_almalinux8() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_repos_almalinux8() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/alma8"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/alma8"
 
     local -a repos=('almalinux' 'almalinux-ha' 'almalinux-nft' 'almalinux-plus')
     repos+=('almalinux-powertools' 'almalinux-resilientstorage' 'almalinux-rt')
index 1b96d4c9fe38d1b8b2eadb705a9417fd3cdeda92..984982ade6fbe78acbd6fad5bae0c969c2941244 100644 (file)
@@ -8,7 +8,7 @@ get_repos_centos8() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_centos8() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos8"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/centos8"
 
     local -a repos=('CentOS-Stream-AppStream' 'CentOS-Stream-BaseOS' 'CentOS-Stream-Extras-common' 'CentOS-Stream-Extras')
     repos+=('CentOS-Stream-HighAvailability' 'CentOS-Stream-NFV' 'CentOS-Stream-PowerTools' 'CentOS-Stream-ResilientStorage')
index 6a857d68f8c849505cbff8b67c54c20cbfe7cfbd..1bc17ce2fcbc95ce0e1530099db959b432c39ed8 100644 (file)
@@ -8,7 +8,7 @@ get_repos_rocky8() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_rocky8() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/rocky8"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/rocky8"
 
     local -a repos=('Rocky-AppStream' 'Rocky-BaseOS' 'Rocky-Extras' 'Rocky-HighAvailability')
     repos+=('Rocky-NFV' 'Rocky-Plus' 'Rocky-PowerTools' 'Rocky-ResilientStorage' 'Rocky-RT')
index 0473cdecf97d6effa02f87ad58ea8f4d946f7509..0373fce97bb1cc9c5fdca45ca31b8fb408937df3 100644 (file)
@@ -8,7 +8,7 @@ get_repos_el8() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_el8() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/el8"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/el8"
 
     local -a repos=('epel' 'icinga' 'pixelpark' 'prometheus' 'puppet')
 
index 71027b15cfb0a7b2e3160ffeb30d8eb8f300dd5a..7917fa30e6288d35141491170426223900032b59 100644 (file)
@@ -8,7 +8,7 @@ get_repos_almalinux9() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_repos_almalinux9() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/alma9"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/alma9"
 
     local -a repos=('almalinux-appstream' 'almalinux-baseos' 'almalinux-crb' 'almalinux-extras' )
     repos+=('almalinux-highavailability' 'almalinux-nfv' 'almalinux-plus')
index 0132d971fbb946abb2a8fa13b1a27e4dc7e8c765..4e4ae6f0f4354e7f507058a910093aa0661566ff 100644 (file)
@@ -8,7 +8,7 @@ get_repos_centos9() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_centos9() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/centos9"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/centos9"
 
     local -a repos=('centos' 'centos-addons')
 
index a106b546f529617b931b3f7dc9c12f8d19192a72..9ff526fd1a64d09810b411304790356f1697431f 100644 (file)
@@ -8,7 +8,7 @@ get_repos_el9() {
     echo "${HASH_LINE}"
     echo "Calling get_repos_el9() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/repos/el9"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/repos/el9"
 
     local -a repos=('pixelpark' 'puppet')
 
index 37e7c2bbfcefc70ea393ac1ce10cc1fb969dae43..170904d48f1b1c1f5f2097d62b136b1dd2d5b948 100644 (file)
@@ -9,7 +9,7 @@ set_bashrc_el7() {
     echo "${HASH_LINE}"
     echo "Calling set_bashrc_el7() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-el7"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/bashrc-el7"
 
     echo
     log "Rewriting /etc/bashrc ..."
index d2dd3a308503c660de22e79d81e3e248e99e493c..28f351d868a0411804c8299f214519c1f45ba28b 100644 (file)
@@ -9,7 +9,7 @@ set_bashrc_centos8() {
     echo "${HASH_LINE}"
     echo "Calling set_bashrc_centos8() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-centos8"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/bashrc-centos8"
 
     echo
     log "Rewriting /etc/bashrc ..."
index d2dd3a308503c660de22e79d81e3e248e99e493c..28f351d868a0411804c8299f214519c1f45ba28b 100644 (file)
@@ -9,7 +9,7 @@ set_bashrc_centos8() {
     echo "${HASH_LINE}"
     echo "Calling set_bashrc_centos8() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/bashrc-centos8"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/bashrc-centos8"
 
     echo
     log "Rewriting /etc/bashrc ..."
index 34929b439e8b6fdfbbad7fb1739de992f6e6c337..dbcdd034b7d6a7c535a8e30f2fe284f0f921cb00 100644 (file)
@@ -9,7 +9,7 @@ set_vimrc_el7() {
     echo "${HASH_LINE}"
     echo "Calling set_vimrc_el7() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/vimrc-el7"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/vimrc-el7"
 
     echo
     log "Rewriting /etc/vimrc ..."
index d85c3f7d817d249342c787be89df326bb40048ec..1d100feb1f890b36cd59fe8ca1e447cd022ac6c7 100644 (file)
@@ -9,7 +9,7 @@ set_vimrc_centos8() {
     echo "${HASH_LINE}"
     echo "Calling set_vimrc_centos8() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/vimrc-centos8"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/vimrc-centos8"
 
     echo
     log "Rewriting /etc/vimrc ..."
index d85c3f7d817d249342c787be89df326bb40048ec..1d100feb1f890b36cd59fe8ca1e447cd022ac6c7 100644 (file)
@@ -9,7 +9,7 @@ set_vimrc_centos8() {
     echo "${HASH_LINE}"
     echo "Calling set_vimrc_centos8() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/vimrc-centos8"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/vimrc-centos8"
 
     echo
     log "Rewriting /etc/vimrc ..."
index e05797037d19655a370d28f79c4c0dbdb83eaa3f..1d1c48cc3bef6347011ceb66246663f22d90034f 100644 (file)
@@ -9,7 +9,7 @@ create_motd() {
     echo "${HASH_LINE}"
     echo "Calling create_motd() ..."
     echo
-    local url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/create-motd.sh"
+    local url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/create-motd.sh"
 
     echo
     log "Creating initial /etc/motd ..."
index 6ec5340d6da09417053c4d99d96c33c1a6f30a35..892abaf40c6e2f26d29a17fb954eba702291865d 100644 (file)
@@ -13,8 +13,8 @@ install_legato() {
     log "Installing Legato networker client packages (backup) ..."
     echo
 
-    local url_client="${COBBLER_URL}/custom/legato/lgtoclnt-latest.x86_64.rpm"
-    local url_man="${COBBLER_URL}/custom/legato/lgtoman-latest.x86_64.rpm"
+    local url_client="${cobbler_url}/custom/legato/lgtoclnt-latest.x86_64.rpm"
+    local url_man="${cobbler_url}/custom/legato/lgtoman-latest.x86_64.rpm"
 
     echo "Installing lgtoclnt ..."
     if yum install -y "lgtoclnt" ; then
index 1f7e229e71ef564615d1af8dca3c4c2d8d12b600..d10f0da4bd72e7064308824b4c546ad185ebed29 100644 (file)
@@ -154,7 +154,7 @@ install_postfix() {
 
     echo
     echo "Getting new master.cf ..."
-    url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/postfix/master.cf"
+    url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/postfix/master.cf"
     tmp_file=$( mktemp )
     wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true
     if [[ -s "${tmp_file}" ]] ; then
@@ -164,7 +164,7 @@ install_postfix() {
     echo
     echo "Getting new virtuals ..."
     cp /dev/null "${tmp_file}"
-    url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}/postfix/virtual"
+    url="${cobbler_url}/${ws_rel_filesdir}/${system_status}/postfix/virtual"
     wget -O "${tmp_file}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" || true
     if [[ -s "${tmp_file}" ]] ; then
         mv -v "${tmp_file}" /etc/postfix/virtual
index 04c98220113033e69c6efd173571b94e98f313aa..1d6af68bdcd197ba5a83b5866d4203a0689205bd 100644 (file)
@@ -9,7 +9,7 @@ config_logrotate() {
     echo "${HASH_LINE}"
     echo "Calling config_logrotate() ..."
     echo
-    local base_url="${COBBLER_URL}/${ws_rel_filesdir}/${system_status}"
+    local base_url="${cobbler_url}/${ws_rel_filesdir}/${system_status}"
 
     log "Configuring logrotation ..."
     echo
index 1b25d01b0cf2c1f03fa164fcd937b6de0d7cd89f..b4609963f64942e71574e8017cc024a62a494e34 100644 (file)
@@ -136,6 +136,7 @@ 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}"
+export cobbler_url="${COBBLER_URL}"
 
 echo
 echo "hostname:             '$hostname'"
@@ -145,6 +146,7 @@ echo "Management interface: '${mgmt_interface}'"
 echo "ip_address_eth0:      '$ip_address_eth0'"
 echo "mac_address_eth0:     '$mac_address_eth0'"
 echo "System status:        '${system_status}'"
+echo "Cobbler URL:          '${cobbler_url}'"
 
 ###############################################################################
 # Performing snippets