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 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 a user 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 following command:
rhncfg-manager mode --help |
Replace mode with the name of the mode to be inspected:
rhncfg-manager diff-revisions --help |
You can see such a list of options for the add mode at Table A-4.
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. The output resembles the following:
Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created |
Once you have created a config channel, use the remaining modes listed above to populate and maintain that channel.
To add a file to a config channel, 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 the 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 file name 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 |
The output resembles the following:
Pushing to channel example-channel Local file >/path/to/file -> remote file /new/path/to/file.txt |
The following table lists the options available for rhncfg-manager add:
Option | Description |
---|---|
-cCHANNEL --channel=CHANNEL | Upload files in this config channel |
-dDEST_FILE --dest-file=DEST_FILE | Upload the file as this path |
--delim-start=DELIM_START | Start delimiter for variable interpolation |
--delim-end=DELIM_END | End delimiter for variable interpolation |
-h, --help | show help message and exit |
Table A-4. rhncfg-manager add options
To view the differences 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/example-config.txt /home/test/blah/hello_world.txt --- /tmp/dest_path/example-config.txt config_channel: example-channel revision: 1 +++ /home/test/blah/hello_world.txt 2003-12-14 19:08:59.000000000 -0500 @@ -1 +1 @@ -foo +hello, world |
The following table lists the options available for rhncfg-manager diff:
Option | Description |
---|---|
-cCHANNEL, --channel=CHANNEL | Get file(s) from this config channel |
-rREVISION, --revision=REVISION | Use this revision |
-dDEST_FILE, --dest-file=DEST_FILE | Upload the file as this path |
-tTOPDIR, --topdir=TOPDIR | Make all files relative to this string |
-h, --help | Show help message and exit |
Table A-5. rhncfg-manager diff options
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.3.11 Determining the Number of File Revisions for related instructions. Specify only one file name here, since you are comparing the file against another version of itself. For example:
rhncfg-manager diff-revisions -n=channel-label1 -r=1 -n=channel-label2 -r=1 /path/to/file.txt |
The output resembles the following:
--- /tmp/dest_path/example-config.txt 2004-01-13 14:36:41 \ config channel: example-channel2 revision: 1 --- /tmp/dest_path/example-config.txt 2004-01-13 14:42:42 \ config channel: example-channel3 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----- |
The following table lists the options available for rhncfg-manager diff-revisions:
To download all the files in a channel to disk, create a directory and issue the following command:
rhncfg-manager download-channel channel-label --topdir . |
The output resembles the following:
Copying /tmp/dest_path/example-config.txt -> \ blah2/tmp/dest_path/example-config.txt |
The following table lists the options available for rhncfg-manager download-channel:
To direct the contents of a particular file to stdout, issue the command:
rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.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 `example-channel3': /tmp/dest_path/example-config.txt |
The following table lists the options available for rhncfg-manager get:
To list all of your organization's configuration channels, issue the command:
rhncfg-manager list-channels |
The output resembles the following:
Available config channels: example-channel example-channel2 example-channel3 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/example-config.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 example-channel3 /tmp/dest_path/example-config.txt removed |
The following table lists the options available for rhncfg-manager remove:
To destroy a config channel in your organization, issue the command:
rhncfg-manager remove-channel channel-label |
The output resembles the following:
Removing config channel example-channel Config channel example-channel removed |
To find out how many revisions (revisions go from 1 to N where N is an integer greater than 0) of a file/path are in a channel, issue the following command:
rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt |
The output resembles the following:
Analyzing files in config channel example-channel \ /tmp/dest_path/example-config.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 following command:
rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file |
The output resembles the following:
Pushing to channel example-channel: Local file example-channel/tmp/dest_path/example-config.txt -> \ remote file /tmp/dest_path/example-config.txt |
The following table lists the options available for rhncfg-manager update:
Option | Description |
---|---|
-cCHANNEL, --channel=CHANNEL | Upload files in this config channel |
-dDEST_FILE, --dest-file=DEST_FILE | Upload the file as this path |
-tTOPDIR, --topdir=TOPDIR | 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 |
-h, --help | Show help message and exit |
Table A-10. rhncfg-manager update options
To upload multiple files to a config channel from local disk at once, issue the command:
rhncfg-manager upload-channel --topdir=topdir channel-label |
The output resembles the following:
Using config channel example-channel4 Uploading /tmp/ola_world.txt from blah4/tmp/ola_world.txt |
The following table lists the options available for rhncfg-manager upload-channel:
Option | Description |
---|---|
-tTOPDIR, --topdir=TOPDIR | Directory all the file paths are relative to |
-cCHANNEL, --channel=CHANNEL | List of channels the config info will be uploaded into. Channels delimited by ','. Example: --channel=foo,bar,baz |
-h, --help | Show help message and exit |
Table A-11. rhncfg-manager upload-channel options