During deployment to an environment, for each deployment target machine, we want to run some steps on the Octopus Server in order to configure the target on an external source (which cannot be accessed from the target machines).
I did find these instructions for running deployment steps on the Octopus server:
However, this article seems to assume that the Octopus server is just another deployment target. We actually don’t want to deploy anything to the Octopus Server itself, we just want it to be the central place certain steps are invoked on behalf of one or more deployment target machines. This requires that the step running on the Octopus Server know the machines being targeted, buts its not clear how to get this information from the Octopus variables.
Thanks for reaching out. Following what that article says to run steps on the Octopus server would be the best way to go to run steps on a “central” machine. Now, that Tentacle can’t run steps “on behalf” of other Tentacles.
What kind of information would you need the “Central Tentacle” to know about the other Tentacles in order for your process to work? i.e The name of the computer, the IP, the machine ID, some other thing?
I’ve written a Powershell function that will get the Machine Object of all the machines in your deployment and return their properties (among them the URL which I think is what you need). This script was made to be ran once from a Central Tentacle (steps 1 & 3 of your outline).
I don’t think that is quite what I was asking for. For our scenario, the
Octopus server does not need to know the names of all the machines, it
needs to know the current target machine on which the deployment process
is running. The outline I gave above has to be done in that order for each
target machine (however, they can occur in parallel across machines). In
the example you provided, the Octopus server can get all the target
machines, but how is it supposed to know which machine to apply it to, for
that particular invocation of the deployment process?
Now I understand what you need. But unfortunately its not possible to run a foreach loop in such a way.
A possible workaround would be running a Powershell script step on each Tentacle that triggers a process on the server running Octopus to run the pre-config process. So each time the Tentacle runs that step it’ll say “Hey server running Octopus! Im [TentacleName] and I need you to trigger the pre-configuration process for me”. You could use Powershell remoting to solve the communication between each Tentacle and the Octopus server.
Another possibility could be to run all the pre-configuration steps altogether from the Octopus server (my script would help you knowing the names of the machines), then deploy the application to each Tentacle and finally run the post configuration from the Octopus server on all servers at once.