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.
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.
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 |
The following options are applicable to the add mode:
Option | Description |
---|---|
-h, --help | Display this list of options and exits. |
-c=, --channel=CHANNEL_LABEL | Required - Use this config channel. |
-d=, --dest-file=DEST_FILE | Conflicts with --topdir - Identify the destination path and filename of a single file. |
-t=, --topdir=TOPDIR | Conflicts with --dest-file - Handle multiple files at a different location than their destination path. Make all files relative to this string. |
--delim-start=DELIM_START | Start delimiter for variable interpolation. |
--delim-end=DELIM_END | End delimiter for variable interpolation. |
Table A-1. Add Options
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 |
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----- |
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 |
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.
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 |
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.
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 |
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 |
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 |
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 |
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 |