using octo.exe i can create environment like this-
Octo create-environment --name “Feature Branch” --server https://octopus.Test.com/ --apikey MYAPIKEY
Now if i go to Octopus server portal (Web interface), i can do following–click on any existing machine and add newly created environment to “Environments” in deployment target settings. This way i can create environment out of existing machines already enrolled with Octopus server.
How can i achieve this using octo.exe.
The docs around octo.exe seems to very simple with no depth. Can it be achieved through REST API.
I’m afraid there’s something I’m not quite understanding: This way i can create environment out of existing machines already enrolled with Octopus server.
Are you implying that you can go to a machine, add a non-existant environment to it, and that would create the environment and add the machine to it? Cause that its not possible.
As a rule of thumb, first you need to create the environment to then add it to a machine.
There’s an OSS project called Octoposh that provides a way to create and Environment and then add machines to it from Powershell using the API on the background.
Let’s say, I have created an environment QA by adding two 2 machines web1 (web server role) and db1 (database server role). For this I installed tentacles on web1 and db1 machines and did other steps to complete the process.
Now, I want to setup another environment UAT on the same machines (web1 and db1). For this i did following in Octopus web interface—
· Added a new environment using “Add Environment” option, provided a name UAT and clicked save.
· Now coming back to environments screen, clicked on web1 machine, which will open its details
Ø In the Deployment target settings > Deployment section there is an Environments field.
Ø In the environments field, I selected UAT as the environment (just added).
· Similar steps, I did for db1 machine.
This way I created another environment, using machines already enrolled with the Octopus server.
This works perfectly fine and many environments can co-exist on few machines.
My question is how can I create an environment using octo.exe and provide it with machine information (name or id) which are already enrolled with the Octopus.