How can I move a host from environment to another

I want to create a host in one environment, do some setup and testing, then move it to a new environment. And I want to do it with the API.

Please, advise.

When you say “setup/testing”? What exactly do you mean? Rancher doesn’t really support moving hosts from one environment to another outside of re-registering the agent using the command from the new environment, but even when doing that, the containers started previously will not have started in the managed network for the new environment. They will be thought of as standalone containers.

When users request a new host, there is a 5-10 minute wait for the machine to be “ready”, then we need to install some things on the host and then verify it’s set up properly for our use - this is the setup/testing part. My thinking was that I could have a few of these hosts in a pool that are ready to go, and then when a request comes in, I’d just move the host to the requester environment. So the wait time would likely be seconds.

For human users the wait is not a big deal, but for some of our automated processes 5-10 minutes seems a bit long.

There are other solutions to this problem, I just thought if it was just a matter of changing environments that would be really easy.

I think you should model your workflow a bit differently. The Hosts are just infrastructure, they providing just resources and the lifecycle for “hosts” software should be rather slow and seldom. I.e. if a new RancherOS, or other OS comes out you should spend some time updating them.

BTW: @denise is there a way of performing Hosts upgrades for RancherOS from Rancher yet?

Your 5-10 minute model should me modeled around Stacks, Services. Thats Rancher and RancherOS all about. And you Prepare Container which are versioned and can be pushed to Production.

@denise We are wondering there is a option to share Hosts (the resources) across environments? Specially if we want to model a multi tenant setup for given applications. Is the environment the right place for doing so? Or whats the right abstraction If I want to spawn an instance of a given application for many tenants?

@hwinkel There is an open feature request for upgrading RancherOS through Rancher.

There is no option to share hosts across environments. You would probably want to do things in the same environment but control the application deployment based on scheduling rules so that only certain hosts are picked.