Hello,
I have a Tentacle auto-deploy & configure script that runs and registers new machines to a “Staging” environment as a default place for them to exist.
If we have deployed 50 -100 machines to this environment, and want to “mass-move” them to a new “Final” environment, is there a scripted way to get this done, or does it have to be done individually fia the Octopus GUI?
Thanks,
Karl
Hi Karl,
The REST API does support you getting machines, changing the environment ID’s, and PUTting them back. There’s no tools built to do this however, so you’d need to code it against the API yourself. Alternatively you could do it via the Raven management studio, or through the GUI as you mentioned.
Paul
Hello Paul,
I am re-opening this discussion, because we are beginning the migration from Octo 1.6.x to Octo 2.5.7.384 -
We have decided to run our new 2.0 server alongside the 1.6 server, using different listening ports for the tentacles. This allows us to remove the 1.6 tentacle, and then install the 2.0 tentacle and register it with the new server. (I will use a PS script to do the 2.0 tentacle install, just like I did with the 1.6 tentacle deployment.)
Unfortunately, after restoring the database from the 1.6 server to the 2.0 server, all the machines were added to the new 2.0 server and are all coming up “offline” due to the port difference. Expected, and not entirely bad, as we were able to transfer all of the environment names over, etc. and also still keep the machines operating in the 1.6 server until we switch them over.
Which brings me to my question - we need a way to remove/delete multiple machine accounts at once, so that I can clear out the machines on the 2.0 server, thus making it cleaner and ready to accept the new 2.0 tentacles once I install and register them with the 2.0 server.
I know that it requires some API coding in v1.x, but have there been any changes or utilities created to do this in the 2.x server environment? We initially looked at octo.exe, but that seems to be more for releases… Thoughts?
Hi Karl,
Thanks for getting in touch! Unfortunately there have been no updates to the utilities or interface in 2.0 to do what you are asking.
The good news is the API is much more advanced and scripting something should be slightly easier.
The following code should be a good start to hacking something together:
var env = Repository.Environments.FindByName("some env");
foreach (var machine in Repository.Environments.GetMachines(env)) {
Repository.Machines.Delete(machine);
}
Hope this helps!
Vanessa
Thanks for the head start Vanessa!
I will use your example to try and get something started.