]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Nearly completing profile.rhel-9.2.develop
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 24 Aug 2023 12:31:29 +0000 (14:31 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 24 Aug 2023 12:31:29 +0000 (14:31 +0200)
bin/create-motd.sh
kickstart/profile.rhel-9.2.develop.ks
snippets/tpl.300.create-motd.sh

index 369dce333b9443058b7d006b7b3bc3ca20d33349..f054d5987d81d14875864b729749ecfd988ad160 100755 (executable)
@@ -1,21 +1,20 @@
 #!/bin/bash
 #
 # Author: Frank Brehm <frank.brehm@pixelpark.com>
-#
-
 #
 # Generating /etc/motd like:
 #
-# +----------------------------------------------------------------+
-# | Nodename:    cobbler         Purpose:   VMWare Template        |
-# | Domain:      pixelpark.com   Location:  L105 / VMWare          |
-# | Network:     192.168.88.8    Owner:     Digitas Pixelpark GmbH |
-# | Hardware:    vmware (x86_64) Contact:   8x5@pixelpark.com      |
-# | OS:          CentOS 7.9.2009 Zone-Host: N/A                    |
-# | Puppet Env:  test            Customer:  pixelpark              |
-# | Puppet Role: default         Project:   <undefined>            |
-# | Puppet Tier: production                                        |
-# +----------------------------------------------------------------+
+# +------------------------------------------------------------------------------------+
+# | Nodename   : template-rhel9                      Purpose  : VMWare Template        |
+# | Domain     : pixelpark.com                       Location : L105 / VMWare          |
+# | Network    : 192.168.145.50                      Owner    : Digitas Pixelpark GmbH |
+# | Hardware   : vmware (x86_64 Intel)               Contact  : solution@pixelpark.com |
+# | OS         : Red Hat Enterprise Linux 9.2 (Plow) Zone-Host: test/test-vmcc-l105-01 |
+# | Puppet-Env : development                         Customer : pixelpark              |
+# | Puppet-Role: dpx_infra::cobbler_tst              Project  : <undefined>            |
+# | Puppet-Tier: development                                                           |
+# | Puppet-Cert: template-rhel9.pixelpark.com                                          |
+# +------------------------------------------------------------------------------------+
 #
 
 set -e
@@ -28,7 +27,7 @@ VERBOSE="n"
 DEBUG="n"
 QUIET='n'
 
-VERSION="0.10.0"
+VERSION="0.11.0"
 
 BASENAME="$(basename ${0})"
 BASE_DIR="$(dirname ${0})"
@@ -63,7 +62,7 @@ HARDWARE=$( uname -p )
 OWNER="Digitas Pixelpark GmbH"
 CONTACT="solution@pixelpark.com"
 COMMENTS=
-ZONE="N/A"
+ZONE="test/test-vmcc-l105-01"
 OS_NAME=$( cat /etc/os-release | grep '^PRETTY_NAME' | awk -F= '{print $2}' | sed -e 's/^"//' -e 's/"$//' )
 if [[ "${OS_NAME}" =~ Oracle ]] ; then
     OS_NAME=$( echo "${OS_NAME}" | sed -e 's/ *Linux *Server/Linux/i' )
@@ -77,6 +76,7 @@ PUPPET_PROJECT="<undefined>"
 PUPPET_ENV="${system_status:-development}"
 PUPPET_ROLE="default"
 PUPPET_TIER="production"
+PUPPET_CERT="${NODENAME}.${DOMAIN}"
 
 #------------------------------------------------------------------------------
 description() {
@@ -261,6 +261,8 @@ get_options() {
         set -x
     fi
 
+    PUPPET_CERT="${NODENAME}.${DOMAIN}"
+
 }
 
 #########################################
@@ -333,13 +335,16 @@ generate() {
     text="OS:          ${OS_NAME}"
     left+=("${text}")
 
-    text="Puppet Env:  ${PUPPET_ENV}"
+    text="Puppet-Env:  ${PUPPET_ENV}"
+    left+=("${text}")
+
+    text="Puppet-Role: ${PUPPET_ROLE}"
     left+=("${text}")
 
-    text="Puppet Role: ${PUPPET_ROLE}"
+    text="Puppet-Tier: ${PUPPET_TIER}"
     left+=("${text}")
 
-    text="Puppet Tier: ${PUPPET_TIER}"
+    text="Puppet-Cert: ${PUPPET_CERT}"
     left+=("${text}")
 
     # Texte rechte Spalte
index 0278f3200448ae646c7c2d7f0428f43fb099f188..69d494172aa19905081a6a1f1c4feeee58e25a82 100644 (file)
@@ -334,13 +334,38 @@ echo
 echo "Using snippet $dist_upgrade_snippet"
 $SNIPPET($dist_upgrade_snippet)
 
+#set $create_motd_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.300.create-motd.sh"
+echo
+echo "Using snippet $create_motd_snippet"
+$SNIPPET($create_motd_snippet)
+
 #set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/tpl.320.root-ssh-login.sh"
 echo
 echo "Using snippet $this_snippet"
 $SNIPPET($this_snippet)
 
-# ###########################
-# Seems to be finished
+#set $chrony_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.400.chrony.sh"
+echo
+echo "Using snippet $chrony_snippet"
+$SNIPPET($chrony_snippet)
+
+#set $puppet_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.450.puppet.sh"
+echo
+echo "Using snippet $puppet_snippet"
+$SNIPPET($puppet_snippet)
+
+#set $logrotate_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.500.logrotate.sh"
+echo
+echo "Using snippet $logrotate_snippet"
+$SNIPPET($logrotate_snippet)
+
+## ###########################
+## Sees to be finished
+
+#set $finish_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.999.finish.sh"
+echo
+echo "Using snippet $finish_snippet"
+$SNIPPET($finish_snippet)
 
 %end
 
index 1d1c48cc3bef6347011ceb66246663f22d90034f..605bc29ad82c24176d01cbe8e2ff6777b28efe5f 100644 (file)
@@ -4,6 +4,8 @@
 #-----------------------------------------------------------
 create_motd() {
 
+    local rhsm='/usr/sbin/subscription-manager'
+
     echo -e "\e[0Ksection_start:$( date +%s ):ks_create_motd\r\e[0KCreating initial MOTD ..."
     echo
     echo "${HASH_LINE}"
@@ -29,6 +31,31 @@ create_motd() {
     fi
     rm -fv "${mk_script}"
 
+    if [[ -d "/etc/motd.d" ]] ; then
+        echo "Cleaning up /etc/motd.d ..."
+        ls -l -A /etc/motd.d
+        local mfile=
+        for mfile in /etc/motd.d/* ; do
+            if [[ ! -f "${mfile}" && ! -L "${mfile}" ]] ; then
+                continue
+            fi
+            rm -fv "${mfile}"
+        done
+
+        if [[ -x "${rhsm}" ]] ; then
+            if [[ "${rhsm_registred}" ]] ; then
+                local rhsm_consumed=$( LC_TIME=de_DE.UTF-8 ${rhsm} list --consumed )
+                local sub_name=$( echo "${rhsm_consumed}" | \
+                        grep -i '^Subscription Name:' | sed -e 's/^Subscription Name: *//' )
+                local till=$( echo "${rhsm_consumed}" | \
+                        grep -i '^Ends:' | sed -e 's/^Ends: *//' )
+                echo "Subscription: ${sub_name}, ends: ${till}" | tee /etc/motd.d/sunscription
+            else
+                echo "The system has no subscription." | tee /etc/motd.d/sunscription
+            fi
+        fi
+    fi
+
     echo -e "\e[0Ksection_end:$( date +%s ):ks_create_motd\r\e[0K"
 }