Seite 1 von 1

Change name of OPSI server

Verfasst: 28 Mär 2015, 23:43
von stept_
Hi,
I have two OPSI servers e.g "opsi-old" and "opsi-new". "opsi-new" is mirrored "opsi-old" (same clients, packages, licenses, config, but with mysql backends for all). Now I need to change name of "opsi-new" to "opsi-old", so all existing clients will connect to the new server. What steps should I take now? What commands are necessary to rename Depot Server (Depot Server=Config server; only one).
OPSI v. 4.0.5@CentOS 7

Re: Change name of OPSI server

Verfasst: 25 Sep 2017, 15:06
von mirkt
I know this is an old topic, but I have struggled with OPSI server (config server + depot) renaming today so I can share my experience.. :)

If you want to rename your server:

1. Change hostname and/or domainname

In my tests I was trying to rename opsi.local.lan VM (provided by OPSI team, Xubuntu) to opsinew.local.lan :)

Code: Alles auswählen

# sed -i 's/opsi/opsinew/' /etc/hostname
# sed -i 's/opsi/opsinew/g' /etc/hosts
# reboot
2. Execute:

Code: Alles auswählen

opsi-admin --no-depot -d method host_renameOpsiDepotserver <old-id> <new-id>
in my case:

Code: Alles auswählen

# opsi-admin --no-depot -d method host_renameOpsiDepotserver opsi.local.lan opsinew.local.lan

Code: Alles auswählen

# service opsiconfd restart
That's it :) but not really..

a) Client's could not mount depot shares, because they were looking not for \\opsinew\opsi_depot, but \\opsinew\opsinew_depot – you have to edit /etc/samba/smb.conf or client config..

b) I have found a bug..
# opsi-admin -d method host_getObjects [] '{"type":"OpsiDepotserver"}'
[
{
"masterDepotId" : null,
"ident" : "opsinew.local.lan",
"networkAddress" : "192.168.1.0/255.255.255.0",
"description" : "",
"inventoryNumber" : "",
"ipAddress" : "192.168.1.200",
"repositoryRemoteUrl" : "webdavs://opsinewnew.local.lan:4447/repository",
"depotLocalUrl" : "file:///var/lib/opsi/depot",
"isMasterDepot" : true,
"notes" : "",
"hardwareAddress" : "08:00:27:0d:9a:35",
"maxBandwidth" : 0,
"repositoryLocalUrl" : "file:///var/lib/opsi/repository",
"opsiHostKey" : "feee94fbcb126b763bd88f0a02c89a5f",
"type" : "OpsiConfigserver",
"id" : "opsinew.local.lan",
"depotWebdavUrl" : "webdavs://opsinewnew.local.lan:4447/depot",
"depotRemoteUrl" : "smb://opsinew/opsinew_depot"
}
]
String opsi was replaced multiple times in some places and I have got opsinewnew instead of opsinew so package management was not working until I fixed:
/var/lib/opsi/config/depots/opsinew.local.lan.ini

Now it looks like everything is OK :) I am going to rename production server..

Re: Change name of OPSI server

Verfasst: 28 Sep 2017, 12:09
von n.wenselowski
Hi mirkt,
mirkt hat geschrieben:a) Client's could not mount depot shares, because they were looking not for \\opsinew\opsi_depot, but \\opsinew\opsinew_depot – you have to edit /etc/samba/smb.conf or client config..

b) I have found a bug..
# opsi-admin -d method host_getObjects [] '{"type":"OpsiDepotserver"}'
[
{
"masterDepotId" : null,
"ident" : "opsinew.local.lan",
"networkAddress" : "192.168.1.0/255.255.255.0",
"description" : "",
"inventoryNumber" : "",
"ipAddress" : "192.168.1.200",
"repositoryRemoteUrl" : "webdavs://opsinewnew.local.lan:4447/repository",
"depotLocalUrl" : "file:///var/lib/opsi/depot",
"isMasterDepot" : true,
"notes" : "",
"hardwareAddress" : "08:00:27:0d:9a:35",
"maxBandwidth" : 0,
"repositoryLocalUrl" : "file:///var/lib/opsi/repository",
"opsiHostKey" : "feee94fbcb126b763bd88f0a02c89a5f",
"type" : "OpsiConfigserver",
"id" : "opsinew.local.lan",
"depotWebdavUrl" : "webdavs://opsinewnew.local.lan:4447/depot",
"depotRemoteUrl" : "smb://opsinew/opsinew_depot"
}
]
String opsi was replaced multiple times in some places and I have got opsinewnew instead of opsinew so package management was not working until I fixed:
/var/lib/opsi/config/depots/opsinew.local.lan.ini
Our way of renaming is to iterate over all the configurations and then change the old id to the new id. As you noted this has some issues if the old hostname was just opsi. We have a ticket open for this.
Probably it would be better to be a little bit more selective when parsing urls.


Kind regards

Niko

PS: General warning: We do not recommend editing the backend directly as an error there can have ugly side effects.