Skip to content

OK-5121 adding uninstall engine playbook#63

Merged
GerryMandell merged 4 commits into
mainfrom
gm/ok-5121-uninstall-engine
Jun 15, 2026
Merged

OK-5121 adding uninstall engine playbook#63
GerryMandell merged 4 commits into
mainfrom
gm/ok-5121-uninstall-engine

Conversation

@GerryMandell

@GerryMandell GerryMandell commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds uninstall_engine.yml, a new playbook that reverses install_engine.yml. Useful for resetting hosts between test runs, manually decommissioning Orka Engine from a node, and as part of CI cleanup workflows that need to leave the lab in a known-clean state.

Why

install_engine.yml lays down a non-trivial amount of state on the host (LaunchDaemon, app bundle, CLI helper, /opt/orka data + state + logs). Until now there was no playbook-driven way to remove it from the orchestration repo. Operators have had to either:

  • SSH in and manually unload the LaunchDaemon, kill processes, and rm -rf the relevant paths
  • Run orka-ansible's remove-all.yml, which depends on a working K8s cluster and is overkill when the engine is the only thing installed
  • Leave stale engine state across CI runs, which can interfere with the next workflow on shared lab hardware

uninstall_engine.yml makes the install/uninstall pair symmetric and removable on its own.

What it removes

  • Unloads the com.macstadium.orka-engine.server.managed LaunchDaemon
  • Removes the LaunchDaemon plist at /Library/LaunchDaemons/com.macstadium.orka-engine.server.managed.plist
  • Kills any running com.macstadium.orka-engine.runvz processes
  • Removes the engine data and state directories at /opt/orka (data, logs, VM state)
  • Removes the engine app at /usr/local/libexec/orka-engine.app
  • Removes the orka-engine CLI helper at /usr/local/bin/orka-engine

Paths match install_engine defaults exactly so this is a true inverse of the installer.

Optional variables

  • uninstall_engine_data (default true) — remove /opt/orka. Set to false to preserve VM state across reinstalls (useful for upgrades where you want to keep cached images and VM data).

README updates included

  • New "Uninstall Engine" section paired with the existing "Install Engine" section
  • Updated project-structure list to include the new playbook
  • Corrected an erroneous reference to install_engine.yml playbook.

Test plan

  • Run install_engine.yml on a clean host — confirm engine installs, LaunchDaemon loads, orka-engine CLI works
  • Run uninstall_engine.yml on the same host — confirm:
    • LaunchDaemon is unloaded (launchctl list | grep orka-engine returns nothing)
    • Plist is gone (/Library/LaunchDaemons/com.macstadium.orka-engine.server.managed.plist)
    • No orka-engine processes running (pgrep orka-engine)
    • /opt/orka, /usr/local/libexec/orka-engine.app, /usr/local/bin/orka-engine are gone
  • Run install_engine.yml again on the now-cleaned host — confirm clean reinstall succeeds (idempotency check)
  • Run uninstall_engine.yml -e "uninstall_engine_data=false" — confirm engine binaries are removed but /opt/orka remains

@@ -0,0 +1,47 @@
---
- name: Unload Orka Engine LaunchDaemon

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ansible lint warning is probably worth reviewing

@ybenchouaf

Copy link
Copy Markdown

Thanks Gerry! Good addition to have symmetry with install_engine.yml. LGTM.

Small note: the README calls it install-engine.yml instead of install_engine.yml. I don't know if that's something we want to fix in this PR, but figured I'd flag it.

@GerryMandell GerryMandell marked this pull request as ready for review June 12, 2026 14:35
@GerryMandell GerryMandell requested review from a team as code owners June 12, 2026 14:35
Comment thread roles/uninstall_engine/tasks/main.yml Outdated
---
- name: Unload Orka Engine LaunchDaemon
become: true
ansible.builtin.command: "launchctl unload {{ uninstall_engine_service_path }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - launchctl unload is deprecated (see man launchctl). We should opt for launchctl bootout - this is what we use in the monorepo and is the preferred modern way of unloading the service

@GerryMandell GerryMandell merged commit 57a3fc0 into main Jun 15, 2026
2 checks passed
@GerryMandell GerryMandell deleted the gm/ok-5121-uninstall-engine branch June 15, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants