11.7. Applying Errata to Multiple Hosts

Use these procedures to review and apply errata to multiple RHEL 7 hosts.

Prerequisites

  • Synchronize Red Hat Satellite repositories with the latest errata available from Red Hat. For more information, see 「Synchronizing Red Hat Repositories」.
  • Register the hosts to an environment and Content View on Satellite Server. For more information, see Registering Hosts in the Managing Hosts guide.
  • Install the katello-agent package on hosts. For more information, see Installing the Katello Agent in the Managing Hosts guide.

    Note that the Katello agent is deprecated and will be removed in a future Satellite version. Migrate your workloads to use the remote execution feature to update clients remotely. For more information, see Host Management Without Goferd and Katello Agent in the Managing Hosts Guide.

Procedure

  1. Navigate to Content > Errata.
  2. Click the name of an erratum you want to apply.
  3. Click to Content Hosts tab.
  4. Select the hosts you want to apply errata to and click Apply to Hosts.
  5. Click Confirm.

For CLI Users

Although the CLI does not have the same tools as the Web UI, you can replicate a similar procedure with CLI commands.

  1. List all installable errata:

    # hammer erratum list \
    --errata-restrict-installable true \
    --organization "Default Organization"
  2. Select the erratum you want to use and list the hosts that this erratum is applicable to:

    # hammer host list \
    --search "applicable_errata = ERRATUM_ID" \
    --organization "Default Organization"
  3. Apply the errata to a single host:

    # hammer host errata apply \
    --host client.example.com \
    --organization "Default Organization" \
    --errata-ids ERRATUM_ID1,ERRATUM_ID2...
  4. The following Bash script applies an erratum to each host for which this erratum is available:

    for HOST in hammer --csv --csv-separator "|" host list --search "applicable_errata = ERRATUM_ID" --organization "Default Organization" | tail -n+2 | awk -F "|" '{ print $2 }' ;
    do
      echo "== Applying to $HOST ==" ; hammer host errata apply --host $HOST --errata-ids ERRATUM_ID1,ERRATUM_ID2 ;
    done

    This command identifies all hosts with erratum_IDs as an applicable erratum and then applies the erratum to each host.

  5. To see if an erratum is applied successfully, find the corresponding task in the output of the following command:

    # hammer task list
  6. View the state of a selected task:

    # hammer task progress --id task_ID