Need to move configuration channels to secondary Satellite server

Latest response

I need to not only move software channels from a primary Satellite server to a secondary server, I also need the configuration channels moved to the secondary server. I am running version 5.6, and thought the ISS function would work. But my Satellite servers are running in "disconnected" mode, and it appears the syncing only works in "connected" mode. Someone tell me if I'm wrong in that assumption. Any further knowledge or insight would be most helpful. Thanks.

Responses

Recommend reading the man page for rhncfg-manager. You may have to install that rpm (rhncfg-management) too.

EDITED: I forgot I made a discussion here that shows at least one method to do this at https://access.redhat.com/discussions/1342733

The man page for rhncfg-manager has a switch for --password - but if you type this in a plain command, it will hit your history file. If you put it in a script, that is a risk as well, but you could IMMEDIATELY change your password --right-after you run this command (have the window open in the satellite server graphical interface).
NOTE: I have --no-- spaces or special characters in my configuration channel names. If you do, the below may not work when it goes to make a directory after the channel name. You can rename your config channels to have no space/special characters (and if someone has a better way, I'm all ears).

#!/bin/bash
rhncfg-manager --username YOUR_SAT_LOGIN --password  TEMP_passd_you_will_change_right_after_you_run_this! list-channels | grep -v Available | perl -ne 'print;chomp;system("mkdir $_;rhncfg-manager --username YOUR_SAT_LOGIN --password SAME_AS_BEFORE download-channel -t $_/ $_")'
# end
Before doing anything else, CHANGE your password in the graphical interface for the user you used for the above script. Do this before proceeding further!!!

Now that script will make a directory for every channel in whatever directory you happen to be in.

To ingest back... cd into the directory you did the above on the server you wish to import your configuration channels. Remove any directories or files that are not true channels, examine the directory first...

cd /to/the/path/where/you/saved/your/config/channels/
ls | perl -ne 'print;chomp;system("rhncfg-manager upload-channel --channel=$_ -t $_/")'

While this worked for me for a satellite server I /replaced/ recently, I DID have to go to each channel and rename actual file names within the configuration channels, but I had all the files. I haven't filed a bug on this because I haven't researched it further.

---EDITED---

If someone has a better way than above, I'm all ears.

Of course, you could use puppet instead - which offers nice features. PixelDrift for instance has done some interesting things with Puppet & Satellite; at some earlier discussion I can no longer find, he mentioned he uses the satellite to push puppet manifests (I believe he said), but he's gone on to implement it with Satellite 6.x.

There is always the option to upgrade to 5.7 and leverage spacecmd (mainly the configchannel_export and configchannel_import functions). Failing that, you can use spacecmd from a non-Red Hat source (with the understanding that it isn't 'officially' supported), or the method that R. Hinton posted above.

(edited a lot)

Rich, thank you - I should have looked at the configchannel_{import,export} functions a bit more - and I was wondering if I could bother you with a few questions below... I'm genuinely curious before I import an existing cc_all.json (result of the export) if it will supplant my existing configuration channels (see below). I suspect it will, but thought I'd ask before running this just to make sure my assumptions of the import are correct.

Murdock, if you are using Satellite 5.6 (or 5.5, no longer supported), you can still use spacecmd, but you just have to grab the rpm from EPEL.

Rich, just curious, what spacecmd option would you use? To backup, I suspect you'd use (of course) enter spacecmd command line interface, then go with configchannel_export which creates a file named "cc_all.json" file.

Rich, my follow-up question to above, would be... I have 38 configuration channels. Let's say a month prior, I created a backup with configchannel_export

-- Then a month after various configuration channel updates, I ingest the "cc_all.json" file from a month prior,

Q1 - (I suspect the answer is "yes") Would I need to be in the same directory as the file "cc_all.json" when I invoked the spacecmd command interface? Or could I use the full path such as configchannel_import /my/path/to/my/json/cc_all.json where I saved it?

Q2 - (I suspect the answer is "yes") If I ran this on a new/replacement or other satellite server, would it simply ingest my current set of configurations that were exported that file named "cc_all.json"?

Q3 - (I suspect the answer is that it would supplant my channels to the original state, is that coorect?) If I ran this a month later on the original satellite server I exported this from, would it supplant the channels I have and revert back to the configuration channel status at the time I made the "cc_all.json" file from a month prior?

--edited for clarity (I hope)--

Hi Rich, if I may trouble you with the questions with my last reply from yesterday, it would be appreciated. Thanks. By the way, I also saw another more complicated method than you suggested at this link https://access.redhat.com/solutions/454033

regarding Q1, the file can be stored whereever you like on the filesystem.

regarding Q2, that is correct. The 'cc_all.json' is an export of EVERY config channel & the associated files & directories.

regarding Q3, In your example (if I understand you correctly), you've taken an export (cc_all.json), then made some changes on your Satellite, then decide to use the export (from the past) to revert the state of the Satellite back to what it was. In that case, spacecmd will exit if it finds a similarly named config channel/file/etc. I generally like to view spacecmd's import/export functionality as being useful to either move from one Satellite to another or as a selective restore mechanism. (I am going to build a new Satellite but migrate the configurations over). Granted, the export from spacecmd is JSON, so you can edit that file as needed.

Thanks Rich

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.