In addition to the SUSE Manager Web interface, SUSE Manager offers two command line tools for managing (Traditional) system configuration files :
The Configuration Client (mgrcfg-client)
The Configuration Manager (mgrcfg-manager)
You can use the mgrcfg-actions tool to enable and disable configuration management on client systems.
To work with these tools install them from the SUSE Manager Tools child channel as root.
zypper in rhncfg-manager
zypper in rhncfg-actions
Install the following package on client systems:
zypper in rhncfg-client
When a configuration file is deployed via SUSE Manager, a backup of the previous file including its full path is stored in the /var/lib/rhncfg/backups/.
The backup retains its filename but has a .rhn-cfg-backup extension appended.
The Actions Control (mgr-actions-control) application is used to enable and disable configuration management on 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 on the system
Uploading a file from the system
Using the diff command to find out what is currently managed on a system with what is available
Running 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 of the /etc/sysconfig/rhn/ directory, Actions Control has to be run by someone with root access.
There is a manpage available, as for most command line tools. First, decide which scheduled actions should be enabled for use by system administrators. The following options enable the various scheduled action modes:
Allow mgrcfg-client to deploy files.
Allow mgrcfg-client to diff files.
Allow mgrcfg-client to upload files.
Allow mgrcfg-client to upload mtime (file modification time).
Allow mgrcfg-client to do everything.
Enable running scripts.
Disable deployment.
Prohibit diff use.
No file uploads allowed.
Disable mtime upload.
Disable all options.
No scripts allowed to run.
Report whether modes are enabled or disabled.
Force the operation without asking first.
Show help message and exit.
Once a mode is set, your system is ready for configuration management through SUSE Manager.
A common option is mgr-actions-control --enable-all.
The Configuration Client (mgrcfg-client) is installed on and run from an individual client system to gain knowledge about how SUSE Manager deploys configuration files to the client.
The Configuration Client offers these primary modes:
list
get
channels
diff
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 ("DoFoS" is a shortcut for "D or F or S", which means "Directory", "File", or "Something else"(?)):
DoFoS Config Channel File F config-channel-17 /etc/example-config.txt F config-channel-17 /var/spool/aalib.rpm F config-channel-14 /etc/rhn/rhn.conf
These configuration files apply to your system. However, there may be duplicate files present in 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 wonder why the second version of /etc/example-config.txt in config-channel-14 does not apply to the client system.
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, therefore mgrcfg-client command does not list the file.
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
View the contents of the file with less or another pager. Note that the file is selected as the most relevant based on the rank of the config channel containing it. This is accomplished within the Configuration tab of the System Details page.
Refer to Section "System Details" (Chapter 4, Systems, User Guide) 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 list of options available for mgrcfg-client get:
Make all file operations relative to this string.
Exclude a file from being deployed with get. May be used multiple times.
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:
rhncfg-client diff --- /etc/test +++ /etc/test 2013-08-28 00:14:49.405152824 +1000 @@ -1 +1,2 @@ This is the first line +This is the second line added
In addition, you can include the --topdir option to compare config files with those located in an arbitrary (and unused) location on the client system, like this:
# 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 from 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 list of the options available for mgrcfg-client verify:
Increase the amount of output detail. Display differences in the mode, owner, and group permissions for the specified config file.
Only show differing files.
Show help message and exit.
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 in the SUSE Manager Web interface. Additionally, some or all of the related maintenance tasks can be scripted.
To use the command line interface, configuration administrators require a SUSE Manager account (username and password) with 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 change the ~/.rhncfgrc configuration file.
The session file is cached in ~/.rhncfg-manager-session to avoid having to log in for every command.
The default timeout for the Configuration Manager is 30 minutes.
To adjust this, add the server.session_lifetime option and a new value to the /etc/rhn/rhn.conf file on the server running the manager.
For example set the time out to 120 minutes:
server.session_lifetime = 120
The Configuration Manager offers the following primary modes:
add
create-channel
diff
diff-revisions
download-channel
get
list
list-channels
remove
remove-channel
revisions
update
upload-channel
Each mode offers its own set of options, which can be displayed by issuing the following command:
mgrcfg-manager mode --help
Replace mode with the name of the mode whose options you want to see:
mgrcfg-manager diff-revisions --help
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 and the local file to be uploaded:
mgrcfg-manager add --channel=channel-label /path/to/file
In addition to the required channel label and the path to the file, you can use the available options for modifying the file during its addition.
For instance, you can alter the path and file name by including the --dest-file option in the command:
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 list of options available for mgrcfg-manager add:
Upload files in this config channel.
Upload the file as this path.
Start delimiter for variable interpolation.
End delimiter for variable interpolation.
Ignore missing local files.
Show help message and exit.
By default, the maximum file size for configuration files is 128KB.
If you need to change that value, find or create the following line in the /etc/rhn/rhn.conf file:
web.maximum_config_file_size=128
Change the value from 128 to whatever limit you need in kilobytes.
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 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 list of options available for mgrcfg-manager diff:
Get file(s) from this config channel.
Use this revision.
Upload the file at this path.
Make all files relative to this string.
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. 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 +blah +-----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 list of options available for mgrcfg-manager diff-revisions:
Use this config channel.
Use this revision.
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 list of options available for mgrcfg-manager download-channel:
Directory to which all the file paths are relative. This option must be set.
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 the 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 list of the options available for mgrcfg-manager get:
Get file(s) from this config channel.
Directory to which all files are relative.
Get this file revision.
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
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 list of the options available for mgrcfg-manager remove:
Remove files from this config channel.
Directory to which all files are relative.
Show help message and exit.
To remove 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 (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 to 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/local/example-config.txt -> \ remote file /tmp/dest_path/example-config.txt
The list of the options available for mgrcfg-manager update:
Upload files in this config channel.
Upload the file to this path.
Directory to which all files are relative.
Start delimiter for variable interpolation.
End delimiter for variable interpolation.
Show help message and exit.
To upload multiple files to a config channel from a 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 list of the options available for mgrcfg-manager upload-channel:
Directory all the file paths are relative to.
List of channels the config info will be uploaded into channels delimited by ','. Example: --channel=foo,bar,baz.
Show help message and exit.
mgr-sync should be used if SUSE Manager is connected to SUSE Customer Center (SCC).
With mgr-sync you may add or synchronize products and channels.
The mgr-sync command also enables and refreshes SCC data.
This tool requires that SCC is enabled by running mgr-sync enable-scc first (Enabled by default in Uyuni 2.1 and greater).
By default, log rotation of spacewalk-repo-sync is disabled.
This logfile is run by a cron job, and managed by a configuration file.
You can enable log rotation by editing the configuration file at etc/sysconfig/rhn/reposync and setting the MAX_DAYS parameter.
This will permit the deletion of files that are older than the specified period of time.
mgr-sync now requires the username/password of a SUSE Manager administrator.
Most functions are available as part of the public API.
mgr-sync provides a command structure with sub-commands similar to git or osc. For a complete list of command line option, see the mgr-sync manpage (man mgr-sync). Basic actions are:
mgr-sync enable-scc mgr-sync list channel(s)|product(s)|credentials mgr-sync add channel(s)|product(s)|credentials mgr-sync delete credentials mgr-sync refresh [--refresh-channels] [--from-mirror MIRROR]
See the following examples.
mgr-sync list channels
mgr-sync add channel LABEL
mgr-sync list products
mgr-sync add product
mgr-sync refresh
mgr-sync refresh --refresh-channels
mgr-sync list credentials
mgr-sync add credentials
There can be one primary credential only. This is username/password used first when retrieving the list of available channels and packages.
mgr-sync add credentials --primary
mgr-sync delete credentials
SUSE Manager provides the smdba command for managing the installed database.
It is the successor of db-control, which is now unsupported.
The smdba command works on local databases only, not remote. This utility allows you to do several administrative tasks like backing up and restoring the database. It also allows you to create, verify, restore backups, obtaining database status, and restart the database if necessary. The smdba command supports PostgreSQL.
Find basic information about smdba in the smdba manpage.
If you have stopped or restarted the database, Spacewalk services can lose their connections. In such a case, run the following command:
spacewalk-service restart
Depending on the database installed, smdba provides several subcommands:
backup-hot Enable continuous archiving backup backup-restore Restore the SUSE Manager Database from backup. backup-status Show backup status. db-start Start the SUSE Manager Database. db-status Show database status. db-stop Stop the SUSE Manager Database. space-overview Show database space report. space-reclaim Free disk space from unused object in tables and indexes. space-tables Show space report for each table. system-check Common backend healthcheck.
For a list of available commands on your particular appliance, call smdba help.
To display the help message for a specific subcommand, call smdba COMMAND help.
There are three commands to start, stop, or get the status of the database. Use the following commands:
# smdba db-status Checking database core... online # smdba db-stop Stopping the SUSE Manager database... Stopping listener: done Stopping core: done # smdba db-status Checking database core... offline # smdba db-start Starting listener: done Starting core... done
The mgr-create-bootstrap-repo command is used on the Uyuni Server to create a new bootstrap repository.
Use the -l option to list all available repositories:
# mgr-create-bootstrap-repo -l
You can then invoke the command with the appropriate repository name to create the bootstrap repository you require, for example:
# mgr-create-bootstrap-repo SLE-version-x86_64
[[at.clitools.createbootstraprepo.customchannels]] === Creating a Bootstrap Repository with Custom Channels
Custom channels are channels that have been created to manage any custom packages that an organization might require. To create a new bootstrap repository from a custom channel, use the [code]``mgr-create-bootstrap-repo`` command with the [code]``with-custom-channels`` option:
# mgr-create-bootstrap-repo --with-custom-channels
If you create a bootstrap repository that contains custom channels, and later attempt to rebuild with the mgr-create-bootstrap-repo command, the custom channel information will remain in the bootstrap repository.
If you want to remove custom channel information from your bootstrap repository, you will need to use the flush option when you rebuild:
# mgr-create-bootstrap-repo --flush