A.2. Red Hat Network Configuration Manager

Unlike the Red Hat Network Configuration Client, the Red Hat Network Configuration Manager (rhncfg-manager) is designed to maintain RHN's central repository of config files and channels, not those located on client systems. This tool offers a command line alternative to the configuration management features within the RHN website, as well as the ability to script some or all of the related maintenance.

It is intended for use by Config Administrators and in fact requires an RHN username and password that has the appropriate permission set. The username may be specified in /etc/sysconfig/rhn/rhncfg-manager.conf or in the [rhncfg-manager] section of ~/.rhncfgrc.

When the Red Hat Network Configuration Manager is run as root, it attempts to pull in needed configuration values from the Red Hat Update Agent. When run as something other than root, you may have to make configuration changes within the ~/.rhncfgrc file. The session file is cached in ~/.rhncfg-manager-session to prevent logging in for every command.

The default timeout for the Red Hat Network Configuration Manager is 30 minutes. To alter this, add the server.session_lifetime option and new value to the /etc/rhn/rhn.conf file on the server running the manager, like so:

server.session_lifetime = 120

The Red Hat Network Configuration Manager offers these primary modes: add, create-channel, diff, diff-revisions, download-channel, get, list, list-channels, remove, remove-channel, revisions, update, and upload-channel.

Each mode offers its own set of options, which can be seen by issuing the command, rhncfg-manager mode --help, such as:

rhncfg-manager diff-revisions --help

You can see such a list of options for the add mode at Section A.2.2.1 Add Options.

A.2.1. Creating a Config Channel

To create a config channel for your organization, issue the command:

rhncfg-manager create-channel channel-label

If prompted for your RHN username and password, provide them. You should see output resembling:

Red Hat Network username: rhn-user
Password:
Creating config channel channel-label
Config channel channel-label created

Once you've created a config channel, you have the remaining modes available for populating and maintaining that channel.

A.2.2. Adding Files to a Config Channel

To add a file to a config channel, you need to specify the channel label, as well as the local file to be uploaded, such as:

rhncfg-manager add
	  --channel=channel-label
	  /path/to/file

In addition to the required channel label and path to the file, you may use the available options for modifying the file during its addition. For instance, you may alter the path and filename by including the --dest-file option in the command, like:

rhncfg-manager add
	  --channel=channel-label
	  --dest-file=/new/path/to/file.txt 
	  /path/to/file

You should see output resembling:

Pushing to channel blah
Local file >/path/to/file -> remote file /new/path/to/file.txt

A.2.2.1. Add Options

The following options are applicable to the add mode:

OptionDescription
-h, --helpDisplay this list of options and exits.
-c=, --channel=CHANNEL_LABELRequired - Use this config channel.
-d=, --dest-file=DEST_FILEConflicts with --topdir - Identify the destination path and filename of a single file.
-t=, --topdir=TOPDIRConflicts with --dest-file - Handle multiple files at a different location than their destination path. Make all files relative to this string.
--delim-start=DELIM_STARTStart delimiter for variable interpolation.
--delim-end=DELIM_ENDEnd delimiter for variable interpolation.

Table A-1. Add Options

A.2.3. Differentiating between Latest Config Files

To obtain a difference between the config files on disk and the latest revisions in a channel, issue the command:

rhncfg-manager diff
	  --channel=channel-label
	  --dest-file=/path/to/file.txt 
	  /local/path/to/file

You should see output resembling:

/tmp/dest_path/foo.txt /home/test/blahhello_world.txt
--- /tmp/dest_path/foo.txt      config_channel: blah   revision: 1
+++ /home/test/blah/hello_world.txt   2003-12-14 19:08:59.000000000
-0500
@@ -1 +1 @@
-foo
+hello, world

A.2.4. Differentiating between Various Versions

To compare different versions of a file across channels and revisions, use the -r flag to indicate which revision of the file should be compared and the -n flag to identify the two channels to be checked. Refer to Section A.2.11 Determining the Number of File Revisions for related instructions. Note that you specify only one filename here, since you're comparing the file against another version of itself, such as:

rhncfg-manager diff-revisions
	  -n=channel-label1
	  -r=1
	  -n=channel-label2
	  -r=1
	  /path/to/file.txt

You should see output resembling:

--- /tmp/dest_path/foo.txt      2004-01-13 14:36:41     config
channel: blah2  revision: 1
--- /tmp/dest_path/foo.txt      2004-01-13 14:42:42     config
channel: blah3  revision: 1
@@ -1 +1,20 @@
-foo
+blaaaaaaaaaaaaaaah
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.0.6 (GNU/Linux)
+Comment: For info see http://www.gnupg.org
+
+iD8DBQA9ZY6vse4XmfJPGwgRAsHcAJ9ud9dabUcdscdcqB8AZP7e0Fua0NmKsdhQCeOWHX
+VsDTfen2NWdwwPaTM+S+Cow=
+=Ltp2
+-----END PGP SIGNATURE-----

A.2.5. Downloading All Files in a Channel

To download all the files in a channel to disk, create a directory and issue the command:

rhncfg-manager download-channel channel-label --topdir .

You should see output resembling:

Copying /tmp/dest_path/foo.txt -> blah2/tmp/dest_path/foo.txt

A.2.6. Getting the Contents of a File

To get the contents of a particular file to stdout, issue the command:

rhncfg-manager get
	  --channel=channel-label
	  /tmp/dest_path/foo.txt

You should see the contents of the file as output.

A.2.7. Listing All Files in a Channel

To list all the files in a channel, issue the command:

rhncfg-manager list channel-label

You should see output resembling:

Files in config channel `blah3':
  /tmp/dest_path/foo.txt

A.2.8. Listing All Config Channels

To list all of your organization's configuration channels, issue the command:

rhncfg-manager list-channels

You should see output resembling:

Available config channels:
  blah
  blah2
  blah3
  config-channel-14
  config-channel-17

Note that this does not list local_override or server_import channels.

A.2.9. Removing a File from a Channel

To remove a file from a channel, issue the command:

rhncfg-manager remove
	  --channel=channel-label
	  /tmp/dest_path/foo.txt

If prompted for your RHN username and password, provide them. You should see output resembling:

Red Hat Network username: rhn-user
Password:
Removing from config channel blah3
/tmp/dest_path/foo.txt removed

A.2.10. Deleting a Config Channel

To detroy a config channel in your organization, issue the command:

rhncfg-manager remove-channel channel-label

You should see output resembling:

Removing config channel blah
Config channel blah removed

A.2.11. Determining the Number of File Revisions

To find out how many revisions (revisions go from 1 to N with N being an integer greater than 0) of a file/path are in a channel, issue the command:

rhncfg-manager revisions channel-label /tmp/dest_path/foo.txt

You should see output resembling:

Analyzing files in config channel blah
/tmp/dest_path/foo.txt: 1

A.2.12. Updating a File in a Channel

To create a new revision of a file in a channel (or add the first revision to that channel if none existed before for the given path), issue the command:

rhncfg-manager update
	  --channel=channel-label
	  --dest-file=/path/to/file.txt 
	  /local/path/to/file

You should see output resembling:

Pushing to channel blah:
Local file blah/tmp/dest_path/foo.txt -> remote file /tmp/dest_path/foo.txt

A.2.13. Uploading Multiple Files at Once

To upload multiple files to a config channel from local disk at once, issue the command:

rhncfg-manager upload-channel
	  --topdir=topdir
	  channel-label

You should see output resembling:

Using config channel blah4
Uploading /tmp/ola_world.txt from blah4/tmp/ola_world.txt