Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ A web-based UI for running playbooks is available via [Ansible Semaphore](https:
├── pull_image.yml # Main playbook for pulling an image on all hosts
├── create_image.yml # Main playbook for creating an image and pushing it to a remote registry
├── list.yml # Main playbook for listing VMs
├── install-engine.yml # Main playbook for installing Orka Engine
├── install_engine.yml # Main playbook for installing Orka Engine
├── uninstall_engine.yml # Main playbook for uninstalling Orka Engine
├── install_android_sdk.yml # Main playbook for installing Android SDK
├── uninstall_android_sdk.yml # Main playbook for uninstalling Android SDK and tooling
├── sdkmanager_install.yml # Main playbook for installing Android SDK platforms and system images
Expand Down Expand Up @@ -90,6 +91,27 @@ where:

**Note** - To force redeployment or upgrade pass `-e "install_engine_force=true"`.

#### Uninstall Engine

To remove Orka Engine from target hosts. This is the inverse of `install_engine.yml`:

```bash
ansible-playbook uninstall_engine.yml -i dev/inventory
```

By default this will:

- Unload the `com.macstadium.orka-engine.server.managed` LaunchDaemon
- Kill any running `com.macstadium.orka-engine.runvz` processes
- Remove the LaunchDaemon plist at `/Library/LaunchDaemons/com.macstadium.orka-engine.server.managed.plist`
- Remove the engine data and state directories at `/opt/orka`
- Remove the engine app at `/usr/local/libexec/orka-engine.app`
- Remove the `orka-engine` CLI helper at `/usr/local/bin/orka-engine`

Optional variables:

- `uninstall_engine_data` (default `true`) — remove `/opt/orka` (engine data, state, and logs). Set to `false` to preserve VM state across reinstalls.

#### Install Android SDK

To install the Android SDK and AVD runtime tooling on target hosts:
Expand Down
12 changes: 12 additions & 0 deletions roles/uninstall_engine/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
uninstall_engine_service_id: "com.macstadium.orka-engine.server.managed"
uninstall_engine_service_path: "/Library/LaunchDaemons/{{ uninstall_engine_service_id }}.plist"
uninstall_engine_data_home: "/opt"
uninstall_engine_state_home: "/opt"
uninstall_engine_data_dir: "{{ uninstall_engine_data_home }}/orka"
uninstall_engine_state_dir: "{{ uninstall_engine_state_home }}/orka"
uninstall_engine_log_file: "{{ uninstall_engine_state_dir }}/logs/{{ uninstall_engine_service_id }}.log"
uninstall_engine_app_path: "/usr/local/libexec/orka-engine.app"
uninstall_engine_helper_path: "/usr/local/bin/orka-engine"
uninstall_engine_process: "com.macstadium.orka-engine.runvz"
uninstall_engine_data: true
47 changes: 47 additions & 0 deletions roles/uninstall_engine/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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

become: true
ansible.builtin.command: "launchctl bootout system/{{ uninstall_engine_service_id }}"
register: uninstall_engine_unload
failed_when: false
changed_when: uninstall_engine_unload.rc == 0

- name: Remove Orka Engine LaunchDaemon plist
become: true
ansible.builtin.file:
path: "{{ uninstall_engine_service_path }}"
state: absent

- name: Find Orka Engine processes
community.general.pids:
name: "{{ uninstall_engine_process }}"
register: uninstall_engine_pids

- name: Kill Orka Engine processes
become: true
ansible.builtin.command: "kill {{ item }}"
loop: "{{ uninstall_engine_pids.pids }}"
changed_when: true

- name: Remove Orka Engine data directory
become: true
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "{{ uninstall_engine_data_dir }}"
- "{{ uninstall_engine_state_dir }}"
- "{{ uninstall_engine_log_file }}"
when: uninstall_engine_data | bool

- name: Remove Orka Engine app
become: true
ansible.builtin.file:
path: "{{ uninstall_engine_app_path }}"
state: absent

- name: Remove Orka Engine CLI helper
become: true
ansible.builtin.file:
path: "{{ uninstall_engine_helper_path }}"
state: absent
6 changes: 6 additions & 0 deletions uninstall_engine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Uninstall Orka Engine
hosts: hosts
gather_facts: false
roles:
- role: uninstall_engine
Loading