Contents
In addition to the options provided in the SUSE Manager website, SUSE Manager
offers two command line tools for managing a system's configuration files:
the Configuration Client and the
Configuration Manager. There is a complementary
Actions Control tool that is used to enable and
disable configuration management on client systems. If you do not yet have
these these tools installed, they can be found within the
SUSE Manager Tools child channel for your operating
system (package names are: rhncfg-client
,
rhncfg-management
, and
rhncfg-actions
).
![]() | Tip |
---|---|
Keep in mind, whenever a configuration file is deployed via SUSE Manager, a
backup of the previous file including its full path is made in the
|
The Actions Control
(mgr-actions-control) application is used to enable
and disable configuration management of a system. Client systems cannot
be managed in this fashion by default. This tool allows SUSE Manager
Administrators to enable or disable specific modes of allowable actions
such as: deploying a configuration file onto the
system, uploading a file from the system,
diffing what is currently managed on a system and
what is available, or allowing running arbitrary remote
commands. These various modes are enabled/disabled by
placing/removing files and directories in the
/etc/sysconfig/rhn/allowed-actions/
directory. Due
to the default permissions on the
/etc/sysconfig/rhn/
directory, Actions Control will
most likely have to be run by someone with root access.
There is a man page available, as there are for most command line tools, though the use of this tool is simple enough to describe here briefly. Simply decide what scheduled actions should be enabled for use by system administrators. The following options enable the various scheduled action modes:
Table A.1. mgr-actions-control options
Option | Description |
---|---|
--enable-deploy | Allow mgrcfg-client to deploy files. |
--enable-diff | Allow mgrcfg-client to diff files. |
--enable-upload | Allow mgrcfg-client to upload files. |
--enable-mtime-upload | Allow mgrcfg-client to upload mtime. |
--enable-all | Allow mgrcfg-client to do everything. |
--enable-run | Enable script run. |
--disable-deploy | Disable deployment. |
--disable-diff | Disable diff |
--disable-upload | Disable upload |
--disable-mtime-upload | Disable mtime upload |
--disable-all | Disable all options |
--disable-run | Disable script run. |
--report | Report whether the modes are enabled or disabled. |
-f, --force | Force the operation without asking first. |
-h, --help | Show help message and exit. |
Once a mode is set—and for many, mgr-actions-control --enable-all is common—your system is now ready for config management through SUSE Manager.
As the name implies, the Configuration Client (mgrcfg-client) is installed and run from an individual client system. From there you may use it to gain knowledge about how SUSE Manager deploys configuration files to the client.
The Configuration Client offers these primary modes: list, get, channels, diff, and verify.
To list the configuration files for the machine and the labels of the config channels containing them, issue the command:
mgrcfg-client list
The output resembles the following list:
Config Channel File config-channel-17 /etc/example-config.txt config-channel-17 /var/spool/aalib.rpm config-channel-14 /etc/rhn/rhn.conf
These are the configuration files that apply to your system. However, there may be duplicate files present in the other channels. For example, issue the following command:
mgrcfg-manager list config-channel-14
and observe the following output:
Files in config channel 'config-channel-14' /etc/example-config.txt /etc/rhn/rhn.conf
You may then wonder where the second version of
/etc/example-config.txt
went. The rank of the
/etc/example-config.txt
file in
config-channel-17 was higher than that of the same
file in config-channel-14. As a result, the version
of the configuration file in config-channel-14 is not
deployed for this system, although the file still resides in the
channel. The mgrcfg-client command does not list the
file because it will not be deployed on this system.
To download the most relevant configuration file for the machine, issue the command:
mgrcfg-client get /etc/example-config.txt
You should see output resembling:
Deploying /etc/example-config.txt
You may then view the contents of the file with less or another pager. Note that the file is selected as the most relevant based upon the rank of the config channel containing it. This is accomplished within the Configuration tab of the System Details page. Refer to Section 3.4.2.9, “System Details” for instructions.
To view the labels and names of the config channels that apply to the system, issue the command:
mgrcfg-client channels
You should see output resembling:
Config channels: Label Name ----- ---- config-channel-17 config chan 2 config-channel-14 config chan 1
The following table lists the options available for mgrcfg-client get:
Table A.2. mgrcfg-client get options
Option | Description |
---|---|
--topdir=TOPDIR | Make all file operations relative to this string. |
-h, --help | Show help message and exit. |
To view the differences between the config files deployed on the system and those stored by SUSE Manager, issue the command:
mgrcfg-client diff
The output resembles the following:
--- /tmp/@3603.0.rhn-cfg-tmp 2004-01-13 14:18:31.000000000 -0500 +++ /etc/example-config.txt 2003-12-16 21:35:32.000000000 -0500 @@ -1,3 +1,5 @@ +additional text
In addition, you may include the --topdir
option to
compare config files with those located in an arbitrary (and
unused) location on the client system, like so:
# mgrcfg-client diff --topdir /home/test/blah/ /usr/bin/diff: /home/test/blah/etc/example-config.txt: No such file or directory /usr/bin/diff: /home/test/blah/var/spool/aalib.rpm: No such file or directory
To quickly determine if client configuration files are different than those associated with it via SUSE Manager, issue the command:
mgrcfg-client verify
The output resembles the following:
modified /etc/example-config.txt /var/spool/aalib.rpm
The file example-config.txt
is locally modified,
while aalib.rpm
is not.
The following table lists the options available for mgrcfg-client verify:
Table A.3. mgrcfg-client verify options
Option | Description |
---|---|
-v, --verbose | Increase the amount of output detail. Displays differences in the mode, owner, and group permissions for the specified config file. |
-h, --help | Show help message and exit. |
Unlike the Configuration Client, the Configuration Manager (mgrcfg-manager) is designed to maintain SUSE Manager'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 SUSE Manager 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 SUSE Manager
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 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 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 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:
mgrcfg-manager mode
--help
Replace mode
with the name of the mode to be
inspected:
mgrcfg-manager diff-revisions --help
You can see such a list of options for the add mode at Table A.4, “mgrcfg-manager add options”.
To create a config channel for your organization, issue the command:
mgrcfg-manager create-channel channel-label
If prompted for your SUSE Manager username and password, provide them.
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:
mgrcfg-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:
mgrcfg-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 mgrcfg-manager add:
Table A.4. mgrcfg-manager add options¶
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 |
![]() | |
By default, the maximum file size for confiugration files is 128KB. If
you need to change that value, find or create the following line in the
web.maximum_config_file_size=128 Change the value from 128 to whatever limit you want in bytes. |
To view the differences between the config files on disk and the latest revisions in a channel, issue the command:
mgrcfg-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 mgrcfg-manager diff:
Table A.5. mgrcfg-manager diff options
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 |
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:
mgrcfg-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 mgrcfg-manager diff-revisions:
Table A.6. mgrcfg-manager diff-revisions options
Option | Description |
---|---|
-cCHANNEL, --channel=CHANNEL | Use this config channel |
-rREVISION, --revision=REVISION | Use this revision |
-h, --help | Show help message and exit |
To download all the files in a channel to disk, create a directory and issue the following command:
mgrcfg-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 mgrcfg-manager download-channel:
Table A.7. mgrcfg-manager download-channel options
Option | Description |
---|---|
-tTOPDIR, --topdir=TOPDIR | Directory all the file paths are relative to. This option must be set. |
-h, --help | Show help message and exit. |
To direct the contents of a particular file to stdout, issue the command:
mgrcfg-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:
mgrcfg-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 mgrcfg-manager get:
Table A.8. mgrcfg-manager get options
Option | Description |
---|---|
-cCHANNEL, --channel=CHANNEL | Get file(s) from this config channel |
-tTOPDIR, --topdir=TOPDIR | Make all files relative to this string |
-rREVISION, --revision=REVISION | Get this file revision |
-h, --help | Show help message and exit |
To list all of your organization's configuration channels, issue the command:
mgrcfg-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:
mgrcfg-manager remove --channel=channel-label
/tmp/dest_path/example-config.txt
If prompted for your SUSE Manager username and password, provide them.
The following table lists the options available for mgrcfg-manager remove:
Table A.9. mgrcfg-manager remove options
Option | Description |
---|---|
-cCHANNEL, --channel=CHANNEL | Remove files from this config channel |
-tTOPDIR, --topdir=TOPDIR | Make all files relative to this string |
-h, --help | Show help message and exit |
To destroy a config channel in your organization, issue the command:
mgrcfg-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:
mgrcfg-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:
mgrcfg-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 mgrcfg-manager update:
Table A.10. mgrcfg-manager update options
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 |
To upload multiple files to a config channel from local disk at once, issue the command:
mgrcfg-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 mgrcfg-manager upload-channel:
Table A.11. mgrcfg-manager upload-channel options
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 |