Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 15. Managing packages


You can use Satellite to install, upgrade, and remove packages on hosts, as well as to enable or disable repositories on hosts.

15.1. Enabling and disabling repositories on hosts

Use this procedure to enable and disable repositories on hosts for Satellite.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts,
  2. Select the host name.
  3. Click the Content tab.
  4. Click the Repository Sets tab.
  5. Click the vertical ellipsis to choose Override to disabled or Override to enabled to disable or enable repositories on hosts.

15.2. Installing packages on a host

Use this procedure to review and install packages on a host using the Satellite web UI. The list of packages available for installation depends on the content view and lifecycle environment assigned to the host.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts and select the host you want to install packages on.
  2. On the Content tab, select the Packages tab.
  3. On the vertical ellipsis icon next to the upgrade button, click Install Packages.
  4. In the Install packages window, select the package or packages that you want to install on the host.
  5. Click Install.

By default, the packages are installed using remote execution. For more information about running remote execution jobs, see Configuring and Setting up Remote Jobs in Managing hosts.

Create a body of the API request in the JSON format by following the instructions below.

API procedure

  1. Create the "job_invocation" object and place rest of the body inside this object.
  2. Create the "inputs" object with the "package" field of the string type specifying the packages you want to install. If you are specifying multiple packages, separate them with a whitespace.
  3. Create a "feature" field of the string type with value "katello_package_install".
  4. Create a "search_query" field of the string type and input a search query matching the hosts on which you want to install the packages.
  5. Optional: If you want to install packages as a specific user, create an ssh object with the following fields of the string type:

    • "effective_user" with the name of the ssh user
    • "effective_user_password" with the password of the ssh user if this password is required
  6. Optional: If you want to install packages at a later time, create the "scheduling" object. The object can contain one or both of the following fields of the string type with date, time, and a timezone in the ISO 8601 format:

    • "start_at"- sets the time to install the packages
    • "start_before" - sets the latest time to install the packages. If it is not possible to install the packages by this time, then this action is cancelled.

    If you omit time, it defaults to 00:00:00. If you omit timezone, it defaults to UTC.

  7. Optional: If you want to limit the number of hosts on which the job is run concurrently, create the "concurrency_control" object with the "concurrency_level" field of the integer type. Assign the number of hosts as the field value.
  8. Optional: If you want to install packages at a later time and you want the host search query to be evaluated at a time of running the job, create a "targeting_type" field of the string type with the "dynamic_query" value. This is useful if you expect the result of the search query to be different at the time of running the job due to changed status of the hosts. If you omit this field, it defaults to "static_query".
  9. Send a POST request with the created body to the /api/job_invocations endpoint of your Satellite Server and use a tool like Python to see a formatted response.

    Example API request:

    curl https://satellite.example.com/api/job_invocations \
    -H "content-type: application/json" \
    -X POST \
    -d @Path_To_My_API_Request_Body \
    -u My_Username:My_Password | python3 -m json.tool

Verification

  • In the Satellite web UI, navigate to Monitor > Jobs and see the report of the scheduled or completed remote execution job to install the packages on the selected hosts.

Example API request body

{
  "job_invocation" : {
    "concurrency_control" : {
      "concurrency_level" : 100
    },
    "feature" : "katello_package_install",
    "inputs" : {
      "package" : "nano vim"
    },
    "scheduling" : {
      "start_at" : "2023-09-21T19:00:00+00:00",
      "start_before" : "2023-09-23T00:00:00+00:00"
    },
    "search_query" : "*",
    "ssh" : {
      "effective_user" : "My_Username",
      "effective_user_password" : "My_Password"
    },
    "targeting_type" : "dynamic_query"
  }
}

15.3. Upgrading packages on a host

You can upgrade packages on a host in bulk in the Satellite web UI.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Click the name of the host you want to modify.
  3. Click the Content tab, then click the Packages tab.
  4. Select Upgradable from the Status list.
  5. Select upgrade version from the dropdown menu in Upgradable to column where applicable.
  6. Select the packages you want to upgrade.
  7. Click Upgrade. You get a REX job notification once the remote execution job is complete.

Create a body of the API request in the JSON format by following the instructions below.

API procedure

  1. Create the "job_invocation" object and place rest of the body inside this object.
  2. Create the "inputs" object with the "package" field of the string type specifying the packages you want to update. If you are specifying multiple packages, separate them with a whitespace.
  3. Create a "feature" field of the string type with value "katello_package_update".
  4. Create a "search_query" field of the string type and input a search query matching the hosts on which you want to update the packages.
  5. Optional: If you want to update packages as a specific user, create an ssh object with the following fields of the string type:

    • "effective_user" with the name of the ssh user
    • "effective_user_password" with the password of the ssh user if this password is required
  6. Optional: If you want to update packages at a later time, create the "scheduling" object. The object can contain one or both of the following fields of the string type with date, time, and a timezone in the ISO 8601 format:

    • "start_at"- sets the time to update the packages
    • "start_before" - sets the latest time to update the packages. If it is not possible to update the packages by this time, then this action is cancelled.

    If you omit time, it defaults to 00:00:00. If you omit timezone, it defaults to UTC.

  7. Optional: If you want to limit the number of hosts on which the job is run concurrently, create the "concurrency_control" object with the "concurrency_level" field of the integer type. Assign the number of hosts as the field value.
  8. Optional: If you want to update packages at a later time and you want the host search query to be evaluated at a time of running the job, create a "targeting_type" field of the string type with the "dynamic_query" value. This is useful if you expect the result of the search query to be different at the time of running the job due to changed status of the hosts. If you omit this field, it defaults to "static_query".
  9. Send a POST request with the created body to the /api/job_invocations endpoint of your Satellite Server and use a tool like Python to see a formatted response.

    Example API request:

    curl https://satellite.example.com/api/job_invocations \
    -H "content-type: application/json" \
    -X POST \
    -d @Path_To_My_API_Request_Body \
    -u My_Username:My_Password | python3 -m json.tool

Verification

  • In the Satellite web UI, navigate to Monitor > Jobs and see the report of the scheduled or completed remote execution job to update the packages on the selected hosts.

Example API request body

{
  "job_invocation" : {
    "concurrency_control" : {
      "concurrency_level" : 100
    },
    "feature" : "katello_package_update",
    "inputs" : {
      "package" : "nano vim"
    },
    "scheduling" : {
      "start_at" : "2023-09-21T19:00:00+00:00",
      "start_before" : "2023-09-23T00:00:00+00:00"
    },
    "search_query" : "*",
    "ssh" : {
      "effective_user" : "My_Username",
      "effective_user_password" : "My_Password"
    },
    "targeting_type" : "dynamic_query"
  }
}

15.4. Removing packages from a host

You can remove packages from a host in the Satellite web UI.

Procedure

  1. In the Satellite web UI, navigate to Hosts > All Hosts.
  2. Click the name of the host you want to modify.
  3. Click the Content tab, then click the Packages tab.
  4. Click the vertical ellipsis for the package you want to remove and select Remove. You get a REX job notification once the remote execution job is complete.

Create a body of the API request in the JSON format by following the instructions below.

API procedure

  1. Create the "job_invocation" object and place rest of the body inside this object.
  2. Create the "inputs" object with the "package" field of the string type specifying the packages you want to remove. If you are specifying multiple packages, separate them with a whitespace.
  3. Create a "feature" field of the string type with value "katello_package_remove".
  4. Create a "search_query" field of the string type and input a search query matching the hosts on which you want to remove the packages.
  5. Optional: If you want to remove packages as a specific user, create an ssh object with the following fields of the string type:

    • "effective_user" with the name of the ssh user
    • "effective_user_password" with the password of the ssh user if this password is required
  6. Optional: If you want to remove packages at a later time, create the "scheduling" object. The object can contain one or both of the following fields of the string type with date, time, and a timezone in the ISO 8601 format:

    • "start_at"- sets the time to remove the packages
    • "start_before" - sets the latest time to remove the packages. If it is not possible to remove the packages by this time, then this action is cancelled.

    If you omit time, it defaults to 00:00:00. If you omit timezone, it defaults to UTC.

  7. Optional: If you want to limit the number of hosts on which the job is run concurrently, create the "concurrency_control" object with the "concurrency_level" field of the integer type. Assign the number of hosts as the field value.
  8. Optional: If you want to remove packages at a later time and you want the host search query to be evaluated at a time of running the job, create a "targeting_type" field of the string type with the "dynamic_query" value. This is useful if you expect the result of the search query to be different at the time of running the job due to changed status of the hosts. If you omit this field, it defaults to "static_query".
  9. Send a POST request with the created body to the /api/job_invocations endpoint of your Satellite Server and use a tool like Python to see a formatted response.

    Example API request:

    curl https://satellite.example.com/api/job_invocations \
    -H "content-type: application/json" \
    -X POST \
    -d @Path_To_My_API_Request_Body \
    -u My_Username:My_Password | python3 -m json.tool

Verification

  • In the Satellite web UI, navigate to Monitor > Jobs and see the report of the scheduled or completed remote execution job to remove the packages on the selected hosts.

Example API request body

{
  "job_invocation" : {
    "concurrency_control" : {
      "concurrency_level" : 100
    },
    "feature" : "katello_package_remove",
    "inputs" : {
      "package" : "nano vim"
    },
    "scheduling" : {
      "start_at" : "2023-09-21T19:00:00+00:00",
      "start_before" : "2023-09-23T00:00:00+00:00"
    },
    "search_query" : "*",
    "ssh" : {
      "effective_user" : "My_Username",
      "effective_user_password" : "My_Password"
    },
    "targeting_type" : "dynamic_query"
  }
}

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.