Skip to content

OK-5122 Add uninstall_android_sdk.yml playbook and update readme#60

Merged
GerryMandell merged 5 commits into
mainfrom
gm/ok-5122-uninstall-android-sdk-playbook
May 4, 2026
Merged

OK-5122 Add uninstall_android_sdk.yml playbook and update readme#60
GerryMandell merged 5 commits into
mainfrom
gm/ok-5122-uninstall-android-sdk-playbook

Conversation

@GerryMandell

@GerryMandell GerryMandell commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds uninstall_android_sdk.yml, a new playbook that reverses install_android_sdk.yml. Useful for resetting hosts between test runs, manually decommissioning Android tooling on a node, and as part of CI cleanup workflows.

Why

install_android_sdk.yml lays down a non-trivial amount of state on the host (Java JDK, Android SDK, Homebrew, socat, run-avd, and .zshrc env vars). Until now there was no playbook-driven way to remove it, leaving operators to either:

  • Wipe nodes manually
  • Reimage the host
  • Leave stale tooling in place across test cycles

uninstall_android_sdk.yml makes the install/uninstall pair symmetric and removable.

What it removes

  • run-avd script at /opt/orka/bin/run-avd
  • AVD log directory at /opt/orka/logs/avd/
  • socat (via Homebrew)
  • JAVA_HOME / ANDROID_HOME / PATH block from the user's .zshrc
  • Android SDK directory at /opt/android-sdk
  • Eclipse Temurin JDK 21

Homebrew itself is left in place since it may be used by other tooling on the host. The playbook includes commented-out tasks at the bottom to remove Homebrew if desired.

README updates included

  • New "Uninstall Android SDK" section paired with the install section
  • Updated project-structure list to include the new playbook
  • Fleshed out the existing "Install Android SDK" description to fully reflect what the playbook actually does (Homebrew/socat/run-avd/log dirs were missing) — needed for the new Uninstall section to read symmetrically

Test plan

  • Run install_android_sdk.yml on a clean host — confirm everything listed above is created/installed
  • Run uninstall_android_sdk.yml on the same host — confirm everything listed above is removed (Homebrew remains)
  • Run install_android_sdk.yml again on the now-cleaned host — confirm clean reinstall succeeds (idempotency check)

@GerryMandell GerryMandell marked this pull request as ready for review April 28, 2026 17:58
@GerryMandell GerryMandell requested review from a team as code owners April 28, 2026 17:58
Comment thread uninstall_android_sdk.yml Outdated
cmd: "rmdir /opt/orka/bin 2>/dev/null || true"
changed_when: false

- name: Uninstall socat

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.

Should we uninstall socat? It's installed via brew, and could already be installed on the host (it is a popular tool)

This would be an unintended side effect of running the playbook if it was already installed on the machine

Comment thread uninstall_android_sdk.yml Outdated
path: /Library/Java/JavaVirtualMachines/temurin-21.jre
state: absent

# ── Reverse of install_homebrew ──

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.

Should this be removed? It is commented out

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.

If we want to offer this ability to remove Homebrew - I would instead

  1. Move this logic to a role (it could even be moved to the install_homebrew role)
  2. Have a var to remove Homebrew that defaults to false. Users can set the var to true when running the playbook if they want to remove Homebrew

@GerryMandell

Copy link
Copy Markdown
Contributor Author

I restructured things into roles/uninstall_android_sdk with tasks and defaults to better mirror the structure of the rest of the repo. Every component of the uninstall is now a toggle in defaults/main.yml.

Set socat and homebrew to default to false.

Also updated the readme accordingly.


- name: Remove orka bin directory (if empty)
become: true
ansible.builtin.shell:

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.

nit - I would simply omit this step. The shell command is a bit awkward here, and there's no harm really in the directory being leftover

path: "/Users/{{ ansible_user }}/.zshrc"
marker: "# {mark} ANDROID SDK"
state: absent
when: uninstall_android_sdk_zshrc_block | bool

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.

nit - don't think we need a separate var for this. If we remove the directory, then we can remove it from the users PATH env var as well

(we already do something similar for the homebrew uninstall logic below :))

@GerryMandell GerryMandell merged commit 626592d into main May 4, 2026
2 checks passed
@GerryMandell GerryMandell deleted the gm/ok-5122-uninstall-android-sdk-playbook branch May 4, 2026 15:38
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.

2 participants