Install software then uninstall it at later time

Hi,
I am looking at options to install a piece of software then to uninstall it at a later time.
There might be better options and I am very keen to hear if you have any suggestions but this is what I have looked at so far.

Right now I am trying to figure out if there is a way to do the following. A parent project that will coordinate 2 projects. Can someone please let me know if this is possible, I started to look at triggers but I am not sure if this is the right technology and how to implement it.
Parent Project

  • One project to install the software.
  • One project to un-install the software.

Other options considered:
I though of running one project that installs the software then it would create a scheduled task to uninstall the software but one disadvantage of this is that there would not be any visibility of the scheduled task running and perhaps failing.

I tried the following, this worked ok, but if the target machine restarted the job would fail.

  • a single project with the following groups steps.
  • a set of steps to install the software
  • then added a delay, client side using a PowerShell sleep command
  • then some steps to uninstall the software.

Any help would be greatly appreciated.

Hi @Picante ,

Thanks for reaching out.

To make sure I’m looking at this from the right angle, can you please give me a high level overview of what your end goal is with your process?

With the information you’ve provided, it looks like Runbooks might be the best bet here. You would have one project, and within that project you would have one runbook for installing the app, and a runbook for deleting the app. From there you could create scheduled triggers(assuming you have a set time every day you would like the app to get installed) to install and delete the app at set times.

Please let me know what you think.

Best,
Jeremy

Thanks so much for your reply.
Here is a some more information.
We have an issue were we need can only have software installed on target servers for a limited amount of time.
We would trigger the installation on demand against one or a hand full of servers, and the software would be installed soon after the Installation job is triggered.
We can have the software installed for a day or two but more than that is not acceptable. There is flexibility on the exact un-installation time (at a specific time at the end of a next day or after 48 hours, are acceptable options.)
Hope this helps give more info, I’ll start reading about runbooks, thanks again.

Hi @Picante,

You’re very welcome. Thanks for the information.

I do think Runbooks are the way to go here. You would have two runbooks as I said above, but you would use them in this manner:

Project XYZ

Runbook(or could be a normal deployment if you prefer) (Install App):
Normal steps to install application
Final Step is a Run a Script step that Runs Runbook (Delete App), but use the flag for --runAt, and use some logic to figure out a good time for the uninstall runbook to run. (this requires octo.exe to be on the machine in an accessible location or in PATH)

Runbook (Delete App):
Steps to uninstall the app

Documentation on CLI: Run a runbook - Octopus Deploy

Please let me know if you think that will work for you or if you have more questions.

Best,
Jeremy

Thank you Jeremy, I will play with that idea and let you know how I get on.

From what I have read it appears that the --RunAt option only available on Runbooks, is that correct?
It appears that in the version of octopus that we have installed we might not have the Runbook option (2018.9, I know old version, but it will not be an easy task to get upgraded).
If you have another suggestions let me know, thanks.

Hi @Picante ,

Sorry about that, I didn’t realize you were on a version without runbooks. Yes, you’re right that will only work with runbooks. There is the same parameter for deployments, though, but then you would need 2 projects.

--deployAt=VALUE

Please let me know if that works for you.

Best,
Jeremy

Great, I’ll look at that and report back. Thanks again.

Excuse the newbie questions, but to use the Octo CLI tool in this case, I have to get the tool copied to the target server because it only has a tentacle installed and to use the CLI I have to get an API key created with permissions to run projects, is that correct?
Thanks.

Hi @Picante ,

No worries! Yes, you need to copy the tool.

What some people will do is put the octo.exe tool as a package on their server, and then in the script step reference that package and it will extract so you can use it on any tentacle/worker.

Please let me know if I explained that okay.

Best,
Jeremy

Thanks again, I just wanted to update you. I think I have given up on the option, because of security concerns, I have started to look at another way, perhaps PowerShell calling the rest api.
Cheers.

Hi @Picante ,

You’re very welcome! Thank you for updating me.

If you do end up running into any issues along the way with your new solution, please let us know. I hope you have a great rest of your week.

Thanks,
Jeremy

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.