November 18

Linux: Hammer schedule creation script example

./prd-b-scheduler 
#!/bin/bash

# request dates
echo
echo
echo -e "\033[5m*** PRD B Patching ***\033[0m"
echo
echo Welcome to the DEV server patching scheduler
echo Please be aware that these scripts setup the needed jobs for each environment.
echo Refer to wiki article https://itwiki.domainname.com/index.php/Satellite_Hosts_Updating_Process#Configuration_with_running_count
echo for detail times.
echo
echo -e "\033[1mPatch Date\033[0m"
echo What date are you running the patch?
echo Format: yyyy-mm-dd
        read patchdate
echo
echo -e "\033[1mPatch Time\033[0m"
echo Note: Add 4 hours to the time you want to run the job to convert from EST to UTC.
echo Your time must be between 00:00 and 23:59 UTC.
echo The suggested time in UTC would be 08:00.  All additional jobs for this environment will be scheduled before or after the main autoreboot job as needed.
echo -e What time in UTC would you like to run the main patch?
echo format hh:mm
        read patchtime

# Auto Reboot pull
file1="servers/prd-b-servers-main-autoreboot"
while IFS= read -r list1
do
        # display $line or do somthing with $line
	printf '%s\n' "$list1"
hammer job-invocation create --description-format "Prd-b server patching - auto reboot" --job-template "Patching: Full update - Auto reboot"  --search-query "$list1" --start-at "$patchdate $patchtime"
done <"$file1"

# UM and APIG Autoreboot time split 1
patchtime2=$(date -d "$patchtime today - 180 minutes" +'%H:%M')
echo "$patchtime2"

file2="servers/prd-b-servers-um-apig2-autoreboot"
while IFS= read -r list2
do
        # display $line or do somthing with $line
        printf '%s\n' "$list2"
hammer job-invocation create --description-format "Prd-b um-apig2 patching: full update - auto reboot" --job-template "Patching: Full update - Auto reboot"  --search-query "$list2" --start-at "$patchdate $patchtime2"
done <"$file2"


# UM and APIG Autoreboot time split 2
patchtime3=$(date -d "$patchtime today - 120 minutes" +'%H:%M')
echo "$patchtime3"

file3="servers/prd-b-servers-um-apig3-autoreboot"
while IFS= read -r list3
do
  	# display $line or do somthing with $line
        printf '%s\n' "$list3"
hammer job-invocation create --description-format "Prd-b um-apig3 patching: full update - auto reboot" --job-template "Patching: Full update - Auto reboot"  --search-query "$list3" --start-at "$patchdate $patchtime3"
done <"$file3"

# BAM server shutdown
patchtime4=$(date -d "$patchtime today - 45 minutes" +'%H:%M')
echo "$patchtime4"

file4="servers/prd-b-servers-bam-autoreboot"
while IFS= read -r list4
do
  	# display $line or do somthing with $line
        printf '%s\n' "$list4"
hammer job-invocation create --description-format "Prd-b patching: bam server (prd-b) application shutdown/update/reboot" --job-template "Patching: Bam server (QA/UAT/PRD) application shutdown/update/reboot"  --search-query "$list4" --start-at "$patchdate $patchtime4"
done <"$file4"

# BAM server startup
patchtime5=$(date -d "$patchtime today - 15 minutes" +'%H:%M')
echo "$patchtime5"

file5="servers/prd-b-servers-bam-autoreboot"
while IFS= read -r list5
do
  	# display $line or do somthing with $line
        printf '%s\n' "$list5"
hammer job-invocation create --description-format "Prd-b patching: bam server (prd-b) application startup - done after reboot" --job-template "Patching: Bam server (QA/UAT/PRD) application startup - Done after reboot"  --search-query "$list5" --start-at "$patchdate $patchtime5"
done <"$file5"
Category: Linux | Comments Off on Linux: Hammer schedule creation script example
November 18

Linux: Satellite – Content host error Could not calculate errata status

When re registering a Red HAt server into Satellite Katello does not always want to update properly. Below is the fix. After forcing the katello upload it can take 10 to 15 minutes for the updating process to complete:
On Red Hat Satellite 6 Web UI, Content host error Could not calculate errata status, ensure host is registered and katello-agent is installedSolution Verified – Updated July 26 2018 at 4:48 PM – EnglishEnvironment
    Red Hat Satellite 6.x
Issue
    Katello Agent status says Could not calculate errata status, ensure host is registered and katello-agent is installed
Resolution
    Make sure the katello-agent package is installed from Red Hat Satellite 6.x Tools for RHEL Server RPMS repository.
Raw
# yum info katello-agent  | grep -i repo  
# repoquery -i katello-agent | grep -i repository
    Verify if port #5647 of Satellite is reachable from the content host. Also verify if the goferd service is running, we can also restart it.
Raw
# telnet satellite.example.com 5647
# service goferd status
# service goferd restart
    If the above requirements are all fulfilled, run one-time package upload task to calculate the errata.
Raw
# katello-package-upload -f
    Running the above command will create a package profile update task on Red Hat Satellite Web UI.
    Check it from Satellite Web UI -> Monitor -> Tasks, search using “label ~ Actions::Katello::Host::UploadPackageProfile”
Root Cause
    katello-agent was installed from rhel-7-server-optional-rpms repository.

Category: Linux | Comments Off on Linux: Satellite – Content host error Could not calculate errata status
November 18

Linux: Satellite – fixing issue with more licenses being shown in use then actually are being used

foreman-rake katello:clean_backend_objects
The following changes will not actually be performed.  Rerun with COMMIT=true to apply the changes2 orphaned consumer id(s) found in candlepin.0 orphaned consumer id(s) found in pulp.
foreman-rake katello:clean_backend_objects COMMIT=true

Category: Linux | Comments Off on Linux: Satellite – fixing issue with more licenses being shown in use then actually are being used