Software & Configuration: Setting Up Spacewalk Channels

RedHat Satellite, and by extension Spacewalk, uses a system of channels to organize the software and configuration available to registered systems. In fact, those are the two main types of channel: software and configuration. Software channels contain a collection of repositories and packages that are made available to systems in that channel. Configuration channels contain a number of centrally-managed configuration files that can be deployed to systems registered in that channel.

In this guide, we'll look at basic setup of each type.

Creating Software Channels

Create a Base Channel

Sign in to the Spacewalk web portal. Then, navigate to Channels > Manage Software Channels > Create Channel. Fill in the channel name and label (these are usually the same) and the summary. Then, click Create Channel.

We're going to start off by creating a base channel for CentOS7 machines.

Create Channel

Add the Repositories

Next, we'll add the CentOS7 base repositories to our channel. Navigate to Manage Repositories > Create Repository. Fill in the repository label, repository URL, and select the repository type. For example, for the CentOS7 os repository:

Create Repository
Note: The repository URL should be the location that contains the repodata directory.

In this example, I repeated this process to add the CentOS7 extras and updates repositories.

Assign Repositories to the Channel

We need to tell the base channel we created to use the repositories we just added. To do this, navigate to Channels > Manage Software Channels > channel name > Repositories. Here, select the repositories we just added and click Update Repositories.

Add Repositories to Channel

Create a Child Channel

We're also going to create a child channel. This channel will fall under the base CentOS7 channel we created, but it will provide additional repositories and software. As an example, we're going to create a channel that provides the MariaDB repositories for EL7. To do this, basically repeat the same process.

Navigate to Channels > Manage Software Channels > Create Channel. Provide a channel name, label, and summary. This time, in the Parent Channel drop-down, select the centos7-base channel we created earlier. This will establish the new channel as a child of that channel.

Add the Repository

Navigate to Channels > Manage Software Channels > Manage Repositories > Create Repository. Provide the name, URL, and type of the MariaDB repository.

In our example, we used the following:

Repository name: el7-mariadb
Repository URL: http://yum.mariadb.org/10.3/centos7-amd64/
Repository type: yum

Assign the Repository to the Channel

Navigate to Channels > Manage Software Channels > child channel name > Repositories. Select the MariaDB repository we just added, and click Update Repositories.

Syncing Repository Packages

Spacewalk caches local copies of all the packages for the repositories we add. This allows it to offer those packages to registered clients with lower internet bandwidth costs, especially across larger deployments. Since all of our CentOS7 clients will already have access to the main repositories, we won't bother caching the entirety of the CentOS mirror for this example. We will, however, sync the much smaller MariaDB repository so our clients can access its packages.

To do this, navigate to Channels > Manage Software Channels > MariaDB channel > Repositories > Sync > Sync Now. This will manually start downloading and indexing the packages from the repositories. On the same page, you can create a schedule to automatically sync the repositories.

Note:
This will take a while, even if the repository is relatively small. One way to view the progress of the sync process is by navigating to /var/sattelite/redhat/1/stage. The stage folder is where Spacewalk downloads the packages to before it sorts them to other folders in the 1 directory (where 1 is the ID of the Spacewalk group in question). You can roughly gauge the sync process by seeing how many packages are in this folder.

When the sync process finishes, you should be able to view all the repository's packages by navigating to Channels > Manage Software Channels > MariaDB channel > Packages > List / Remove Packages.

Creating Configuration Channels

Similar to software channels, Spacewalk uses configuration channels to make custom configuration files available to clients subscribed to that channel. These configuration files can be pushed to the clients from the Spacewalk control panel. In this example, we'll create a configuration channel with a fake configuration file, /root/test.conf.

Create the Configuration Channel

Navigate to Configuration > Configuration Channels > Create Config Channel. Give the channel a name, label, and brief description.

Add the Configuration File

To add the /root/test.conf configuration file, navigate to Configuration > Configuration Channels > test channel > Add Files > Create File. Give the file a fully-qualified filename. You can change the file owner and permissions, then fill in the contents in the text field below.

Create a Config File

Then click Create Configuration File. Spacewalk will save the configuration file. You'll notice that it drops you on a page called "Revision 1 of /root/test.conf." This is because Spacewalk will allow you to revise your configuration files and it will track the changes. You can deploy different revisions to different hosts.

Learn from my mistakes:
By default, adding an external repository to a channel (like the MariaDB repository) doesn't add its GPG key to the registered hosts. This means that, without providing the GPG key to the clients, they will be unable to install the software. We'll cover this in the Registering Clients section, but this can be done by pushing the GPG key via a configuration channel to /etc/pki/rpm-gpg and importing it via rpm.