### Start VM Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of powering on a stopped VM. ```bash # Power ON a stopped VM orka3 vm start small-ventura-vm ``` -------------------------------- ### Start VM in Specific Namespace Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of powering on a VM within a specified namespace. ```bash # Power ON a VM in a specific namespace orka3 vm start small-ventura-vm --namespace orka-test ``` -------------------------------- ### Example: Install Microsoft Office Script Source: https://docs.macstadium.com/remote-desktop-vdi/it-admin-onboarding-guide A sample shell script to download and install Microsoft Office. Includes error handling and cleanup of temporary files. ```bash #!/bin/bash set -e echo "Installing Microsoft Office..." curl -L -o /tmp/MicrosoftOffice.pkg "https://download.example.com/office.pkg" sudo installer -pkg /tmp/MicrosoftOffice.pkg -target / if [ -d "/Applications/Microsoft Word.app" ]; then echo "Office installed successfully" else echo "Office installation failed" exit 1 fi rm /tmp/MicrosoftOffice.pkg echo "Office installation complete" ``` -------------------------------- ### Download and Execute Ansible Setup Script Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-ansible Use these commands to download, make executable, and run the Ansible setup script from the repository. This script installs essential tools like Xcode Command Line Tools, pip, and Ansible. ```bash curl https://raw.githubusercontent.com/macstadium/ansible-playbook-osx-ci-setup/master/scripts/ansible_setup.sh -o ~/ansible_setup.sh chmod +x ~/ansible_setup.sh sudo ~/ansible_setup.sh ``` -------------------------------- ### Install Management UI Prerequisites Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/msdc-hosted Install Docker and uv using Homebrew. Docker Desktop is an alternative GUI installer. ```bash brew install docker docker-compose brew install uv ``` -------------------------------- ### Resume VM Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of resuming a suspended VM. ```bash # Resume a suspended VM orka3 vm resume small-ventura-vm ``` -------------------------------- ### View Examples for Namespace Creation Source: https://docs.macstadium.com/orka/orka3-cli-reference/output-formats-and-getting-help To see examples for creating namespaces, use the '--help' flag on the 'namespace create' command. ```bash orka3 namespace create --help ``` -------------------------------- ### Install Homebrew and Verify Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/msdc-hosted Install the Homebrew package manager on your controller machine and run 'brew doctor' to check its installation status. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew doctor ``` -------------------------------- ### Install SDK Platforms and System Images Source: https://docs.macstadium.com/remote-desktop-vdi/reference/ansible-quick-reference Installs specified SDK platforms and system image types. Defaults to installing all available types if not specified. ```ansible ansible-playbook -i dev/inventory sdkmanager_install.yml ``` ```ansible ansible-playbook -i dev/inventory sdkmanager_install.yml -e "platform=android-34" -e "image_types=default,google_apis,google_apis_playstore" ``` -------------------------------- ### Resume VM in Specific Namespace Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of resuming a VM within a specified namespace. ```bash # Resume a VM in a specific namespace orka3 vm resume small-ventura-vm --namespace orka-test ``` -------------------------------- ### View VM Subcommand Help Source: https://docs.macstadium.com/orka/orka-engine/orka-engine-30 Get a list of operations that can be performed on VMs, such as `run`, `list`, `save`, and `start`, by running `orka-engine vm --help`. ```bash orka-engine vm --help ``` -------------------------------- ### Suspend VM Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of suspending a running VM. ```bash # Suspend a running VM orka3 vm suspend small-ventura-vm ``` -------------------------------- ### Install Xcodes.app using Homebrew Source: https://docs.macstadium.com/iaas/bare-metal-macs/common-tools Install the Xcodes application, a tool for managing Xcode installations, using Homebrew. This is a convenient alternative to manual download and installation. ```bash brew install --cask xcodes ``` -------------------------------- ### Install Specific SDK Platforms and System Images Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/android-virtual-devices Customize the installation of SDK platforms and system images by specifying the platform and image types. ```bash ansible-playbook sdkmanager_install.yml -i inventory -e "platform=android-34" -e "image_types=default,google_apis,google_apis_playstore" ``` -------------------------------- ### View Examples for Image Management Source: https://docs.macstadium.com/orka/orka3-cli-reference/output-formats-and-getting-help Access common usage examples for image management commands by using '--help' on a specific image command like 'image copy'. ```bash orka3 image copy --help ``` -------------------------------- ### Stop VM Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of powering off a running VM. ```bash # Power OFF a running VM orka3 vm stop small-ventura-vm ``` -------------------------------- ### Start VM with Ansible Playbook Source: https://docs.macstadium.com/remote-desktop-vdi/reference/ansible-quick-reference This playbook starts a VM. Specify the VM name and set the desired state to 'running'. ```ansible ansible-playbook -i dev/inventory vm.yml -e "vm_name=my-vm" -e "desired_state=running" ``` -------------------------------- ### Install OpenConnect with Homebrew Source: https://docs.macstadium.com/orka/networking-with-orka-at-macstadium/vpn-connection Use this command to install OpenConnect if you have Homebrew package manager installed on your system. ```bash brew install openconnect ``` -------------------------------- ### Start a VM Source: https://docs.macstadium.com/remote-desktop-vdi/it-admin-onboarding-guide Use this command to start a specific virtual machine. Ensure the VM name is correctly specified. ```ansible ansible-playbook -i dev/inventory vm.yml -e "vm_name=webapp-abc123" -e "desired_state=running" ``` -------------------------------- ### Install kubectl using Homebrew Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-persistent-volumes Use this command to install kubectl on macOS if it is not already installed. ```bash brew install kubectl ``` -------------------------------- ### Deploy Basic VM Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-orka3-crd-reference A basic example of deploying a VirtualMachineInstance using a specified image. ```yaml apiVersion: orka.macstadium.com/v1 kind: VirtualMachineInstance metadata: name: my-orka-vm spec: image: ghcr.io/macstadium/orka-images/sonoma:latest ``` -------------------------------- ### Example Configuration Script Structure Source: https://docs.macstadium.com/remote-desktop-vdi/it-admin-onboarding-guide Illustrates the typical structure and naming convention for configuration scripts used in image creation. Scripts execute in alphabetical order. ```bash scripts/ 01_install_dotnet.sh .NET Runtime (required for VDA) 02_install_citrix_vda.sh 03_install_office.sh 04_install_slack.sh 05_configure_system.sh 06_cleanup.sh ``` -------------------------------- ### Start a Group of VMs Source: https://docs.macstadium.com/remote-desktop-vdi/operations/bulk-vm-lifecycle Starts all VMs matching the specified prefix. This command sets the state of the VMs to 'running'. ```bash uv run semaphore/bulk_vm_lifecycle.py manage --prefix [PREFIX] --state running ``` -------------------------------- ### Download and Install Company Portal Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment Downloads the latest Company Portal installer package and installs it on the golden image. This ensures the app is pre-staged, avoiding network dependencies at first boot. ```bash curl -L -o /tmp/CompanyPortal-Installer.pkg "https://go.microsoft.com/fwlink/?linkid=853070" sudo installer -pkg /tmp/CompanyPortal-Installer.pkg -target / ls -d "/Applications/Company Portal.app" ``` -------------------------------- ### Orka CLI VM Deploy Intel-Only Examples Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration Provides examples for Intel-specific VM deployments, including using ISOs, custom serial numbers, GPU passthrough, and disabling network boost. ```bash # Deploy with ISO for fresh macOS install orka3 vm deploy -i emptydisk.img --iso ventura.iso ``` ```bash # Deploy with custom serial number orka3 vm deploy -i 90gbventurassh.img --system-serial A00BC123D4 ``` ```bash # Deploy with GPU passthrough orka3 vm deploy -i 90gbventurassh.img --gpu=true --disable-vnc ``` ```bash # Deploy with disabled network boost orka3 vm deploy -i 90gbventurassh.img --disable-net-boost ``` -------------------------------- ### Configure Management UI Environment Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/msdc-hosted Copy the example environment file and generate an encryption key for the management UI's security settings. ```bash cd ~/orka-automation/orka-engine-orchestration cp semaphore/.env.example semaphore/.env ``` ```bash head -c32 /dev/urandom | base64 ``` -------------------------------- ### Configure Management UI Environment Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/self-hosted Copies the example environment file for Semaphore and opens it for editing. A 32-byte encryption key needs to be generated and pasted into this file. ```bash cd ~/orka-automation/orka-engine-orchestration cp semaphore/.env.example semaphore/.env head -c32 /dev/urandom | base64 vim semaphore/.env ``` -------------------------------- ### Deploy a VM from an Image Source: https://docs.macstadium.com/orka/quick-start-guides/orka3-cli-quick-start Deploy a new virtual machine using a specified image. The example uses a Sequoia image from GHCR. ```bash orka3 vm deploy --image ghcr.io/macstadium/orka-images/sequoia:latest ``` -------------------------------- ### Start a VM Source: https://docs.macstadium.com/remote-desktop-vdi/operations/validation-and-testing Use this playbook to start a stopped VM. Verify successful boot, VDA service restart, re-registration with Citrix Cloud, and desktop availability for user sessions. ```ansible ansible-playbook -i inventory vm.yml -e "vm_name=lifecycle-test-abc123" -e "desired_state=running" ``` -------------------------------- ### Run VM with Hosted Image Source: https://docs.macstadium.com/orka/orka-engine/orka-engine-30 Starts a new VM instance using a specified image from a container registry. Ensure the image URL is correct. ```bash orka-engine vm run sonoma-latest --image ghcr.io/macstadium/orka-images/sonoma:latest ``` -------------------------------- ### Create an Intel-only VM template from ISO Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration Use this command to create an Intel-only VM configuration template for an OS installation from an ISO image. ```bash orka3 vmc create fresh-ventura-vm --image 90gbempty.img --iso ventura.iso ``` -------------------------------- ### Install Android SDK on Hosts Source: https://docs.macstadium.com/remote-desktop-vdi/reference/ansible-quick-reference Installs the Android SDK on target hosts. Use the force option to re-install if already present. ```ansible ansible-playbook -i dev/inventory install_android_sdk.yml ``` ```ansible ansible-playbook -i dev/inventory install_android_sdk.yml -e "install_android_sdk_force=true" ``` -------------------------------- ### Install Android SDK Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/android-virtual-devices Run this Ansible playbook to install the Android SDK, including Homebrew, JDK, platform-tools, and emulator packages. It also configures environment variables. ```bash ansible-playbook install_android_sdk.yml -i inventory ``` -------------------------------- ### Deploy Complex VM Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-orka3-crd-reference An advanced example demonstrating various configuration options for a VirtualMachineInstance, including CPU, GPU passthrough, networking, scheduling, and tagging. ```yaml apiVersion: orka.macstadium.com/v1 kind: VirtualMachineInstance metadata: name: my-advanced-orka-vm spec: cpu: 4 gpuPassthrough: false image: sonoma-90gb-orka3-arm netBoost: true scheduler: default-scheduler vncConsole: true tag: my-tag tagRequired: false ``` -------------------------------- ### Start All VMs on a Host After Reboot Source: https://docs.macstadium.com/remote-desktop-vdi/operations/incident-response This script identifies VMs on a specific host and then starts each one using Ansible. ```bash # Start all VMs on affected host ansible-playbook -i inventory list.yml | grep [HOST-NAME] | awk '{print $1}' | xargs -I {} ansible-playbook -i inventory vm.yml -e "vm_name={}" -e "desired_state=running" ``` -------------------------------- ### Install Node.js 10 LTS with Homebrew Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-homebrew Installs Node.js version 10 LTS and links it to /usr/local/bin for PATH availability. ```bash brew install node@10 brew link node@10 --force ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://docs.macstadium.com/iaas/bare-metal-macs/common-tools Installs the necessary Xcode Command Line Tools required by Homebrew. Run this command in the Terminal. ```bash xcode-select --install ``` -------------------------------- ### Example ISAKMP Security Association Output Source: https://docs.macstadium.com/orka/networking-with-orka-at-macstadium/4-verifying-the-gcp-vpn-tunnel This is an example output from the 'show crypto isakmp sa' command, showing an active IKEv1 security association for a properly configured site-to-site VPN. ```text Result of the command: "show crypto isakmp sa" IKEv1 SAs: Active SA: 1 Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey) Total IKE SA: 1 1 IKE Peer: ... Type : L2L Role : initiator Rekey : no State : MM_ACTIVE There are no IKEv2 SAs ``` -------------------------------- ### Start an Android Virtual Device (AVD) Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/android-virtual-devices Use this command to ensure an AVD is running. The playbook is idempotent and will not restart an already running AVD. ```bash ansible-playbook avd.yml -i inventory -e "vm_name=my-vm" -e "desired_state=running" ``` -------------------------------- ### Orka CLI VM Deploy Basic Examples Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration Demonstrates basic VM deployment scenarios using local or OCI images, specifying names, CPU, memory, and output formats. ```bash # Deploy a VM from a local Orka image orka3 vm deploy -i 90gbventurassh.orkasi ``` ```bash # Deploy a VM from an OCI image orka3 vm deploy -i ghcr.io/my-organization/orka-images/orka-arm:latest ``` ```bash # Deploy with specified name, image, and CPU orka3 vm deploy small-ventura-vm -i 90gbventurassh.orkasi -c 4 ``` ```bash # Deploy with unique name generation orka3 vm deploy small-ventura-vm -i 90gbventurassh.orkasi --generate-name ``` ```bash # Deploy with specified memory and random name orka3 vm deploy -i 90gbventurassh.orkasi -m 10 ``` ```bash # Deploy and display extended information orka3 vm deploy -i 90gbventurassh.orkasi --output wide ``` ```bash # Deploy with custom timeout orka3 vm deploy -i 90gbventurassh.orkasi --timeout 1 ``` -------------------------------- ### Manage VM State with Ansible Source: https://docs.macstadium.com/remote-desktop-vdi/it-admin-onboarding-guide Run the 'vm.yml' playbook to manage the state of virtual machines, such as starting, stopping, or rebooting them. This requires proper inventory setup. ```bash ansible-playbook -i dev/inventory vm.yml ``` -------------------------------- ### Iru Enrollment URL Example Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This is an example of the Iru enrollment URL. Replace 'yourcompany' with your Iru subdomain and 'ENROLLMENTCODE' with the code from your Blueprint. ```text https://yourcompany.kandji.io/enroll/access-code/ENROLLMENTCODE ``` -------------------------------- ### Install Homebrew Package Manager Source: https://docs.macstadium.com/iaas/bare-metal-macs/common-tools Installs Homebrew using an official installation script. This command should be run in the Terminal after Xcode Command Line Tools are installed. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Create Service Account and Grant Access Source: https://docs.macstadium.com/orka/orka3-cli-reference/role-based-access-control-rbac Demonstrates creating a service account and then granting it access to multiple namespaces. ```bash # Create service account in orka-default orka3 sa create sa-jenkins # Grant access to orka-test namespace orka3 rb add-subject --namespace orka-test --serviceaccount orka-default:sa-jenkins # Grant access to orka-production namespace orka3 rb add-subject --namespace orka-production --serviceaccount orka-default:sa-jenkins ``` -------------------------------- ### Example Scripts for Image Creation Source: https://docs.macstadium.com/remote-desktop-vdi/macstadium-vdi-deployment/image-management A list of example shell scripts that can be placed in the /scripts directory to be executed during the golden image creation process. Scripts are executed in alphabetical order. ```shell scripts=( 01_install_dotnet.sh 02_install_citrix_vda.sh 03_configure_system.sh ) ``` -------------------------------- ### Start a Stopped VM Source: https://docs.macstadium.com/orka/orka-engine/orka-engine-30 Start a VM that is currently in a stopped state using the `orka-engine vm start` command. ```bash orka-engine vm start ``` -------------------------------- ### List basic information about available VM configurations Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration List basic information about all available VM configurations. ```bash orka3 vmc list ``` -------------------------------- ### Example Output of 'show crypto ipsec sa' Source: https://docs.macstadium.com/orka/networking-with-orka-at-macstadium/4-verifying-the-gcp-vpn-tunnel This is an example of the expected output when running the 'show crypto ipsec sa' command on a Cisco firewall. It shows the status of inbound and outbound security associations. ```text Result of the command: "show crypto ipsec sa" interface: Outside Crypto map tag: amzn_vpn_map_1, seq num: 1, local addr: ... access-list acl-amzn extended permit ip any ... local ident (addr/mask/prot/port): ... remote ident (addr/mask/prot/port): ... current_peer: ... .... inbound esp sas: ... outbound esp sas: ... ``` -------------------------------- ### Verify Python Installation Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/self-hosted Check if Python 3 is installed on the Mac host. Python 3 is a prerequisite for Ansible, which is used for orchestrating the Orka Engine installation. ```bash python3 --version ``` -------------------------------- ### Get Help for Orka3 CLI Configuration Commands Source: https://docs.macstadium.com/orka/orka3-cli-reference/output-formats-and-getting-help View the help documentation for commands related to Orka3 CLI configuration. ```bash orka3 config --help ``` -------------------------------- ### List VMs in a Group Source: https://docs.macstadium.com/remote-desktop-vdi/operations/bulk-vm-lifecycle Lists all VMs that start with the specified prefix. This is useful for verifying the deployment and checking the status of VMs in a group. ```bash uv run semaphore/bulk_vm_lifecycle.py list --prefix [PREFIX] ``` -------------------------------- ### Install Orka Engine with Ansible Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/msdc-hosted Use this Ansible playbook to install Orka Engine on your hosts. Ensure you replace the placeholder values for the license key and installer URL. ```bash cd ~/orka-automation/orka-engine-orchestration ansible-playbook install_engine.yml -i inventory -e "orka_license_key=YOUR-LICENSE-KEY" -e "engine_url=YOUR-INSTALLER-URL" ``` -------------------------------- ### Get Global Help for Orka3 CLI Source: https://docs.macstadium.com/orka/orka3-cli-reference/output-formats-and-getting-help Access the main help documentation for the Orka3 CLI to understand its structure and available command groups. ```bash orka3 --help ``` -------------------------------- ### Run VM from Latest IPSW Source: https://docs.macstadium.com/orka/orka-engine/orka-engine-30 Use this command to download the latest IPSW and start a VM with a 90 GB disk. The command is blocking; use another terminal for further interactions. ```bash orka-engine vm run latest-ipsw --ipsw latest --disk-size 90 ``` -------------------------------- ### Install Citrix VDA Across VMs Source: https://docs.macstadium.com/remote-desktop-vdi/operations/bulk-vm-lifecycle Installs the Citrix Virtual Delivery Agent (VDA) on multiple VMs. This process includes installing prerequisites, setting hostnames, installing the VDA, and rebooting each VM. Consider adjusting concurrency and task timeouts for large deployments or slow downloads. ```bash uv run semaphore/bulk_vm_lifecycle.py install-citrix --prefix [PREFIX] --citrix-installer-url [INSTALLER_URL] --hostname-suffix [HOSTNAME_SUFFIX] ``` -------------------------------- ### Add Registry Credentials for GitHub Packages Source: https://docs.macstadium.com/orka/orka3-cli-reference/oci-registry-integration Example of adding registry credentials for GitHub Packages in a specific namespace. ```bash # Add registry credentials for GitHub Packages in a specific namespace orka3 regcred add https://ghcr.io --username whoami --password ghp_*** --namespace orka-test ``` -------------------------------- ### Install Orka VM Tools using Homebrew Source: https://docs.macstadium.com/orka/orka-resources/vm-tools Use this command to install Orka VM Tools inside a custom or existing ARM VM. Ensure Homebrew is installed first. ```bash brew install orka-vm-tools ``` -------------------------------- ### Create Jamf Enrollment Script Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This bash script automates the Jamf Pro framework installation and computer record creation. It handles network checks, Jamf binary download, and enrollment initiation. Use this script in your golden image at `/usr/local/bin/jamf-enroll.sh`. ```bash mkdir -p /usr/local/bin ``` ```bash #!/bin/bash # Runs at boot via LaunchDaemon. Installs the Jamf management framework # and creates a computer record in Jamf Pro. MDM profile installation # is handled separately via the login prompt. JSS_URL="https://yourcompany.jamfcloud.com" INVITATION_CODE="YOUR_INVITATION_CODE_HERE" JAMF_BINARY="/usr/local/jamf/bin/jamf" TMP_JAMF="/tmp/jamf" DAEMON_PLIST="/Library/LaunchDaemons/com.yourcompany.jamf-enroll.plist" LOG="/var/log/jamf-enroll.log" MAX_ATTEMPTS=10 ATTEMPT_FILE="/var/tmp/.jamf-enroll-attempts" log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $1" >> "$LOG" } attempts=0 [ -f "$ATTEMPT_FILE" ] && attempts=$(cat "$ATTEMPT_FILE") if [ "$attempts" -ge "$MAX_ATTEMPTS" ]; then log "Max attempts ($MAX_ATTEMPTS) reached. Verify invitation code and JSS reachability." exit 1 fi if profiles status -type enrollment 2>/dev/null | grep -q "MDM enrollment: Yes"; then log "MDM enrolled. Cleaning up LaunchDaemon." launchctl unload "$DAEMON_PLIST" 2>/dev/null rm -f "$DAEMON_PLIST" "/usr/local/bin/jamf-enroll.sh" "$ATTEMPT_FILE" exit 0 fi network_ready=false for i in $(seq 1 12); do if curl -s --connect-timeout 5 -o /dev/null "${JSS_URL}/healthCheck.html"; then network_ready=true break fi log "Waiting for network... attempt $i" sleep 5 done if [ "$network_ready" = false ]; then log "Network not available. Will retry at next boot." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 1 fi if [ ! -f "$JAMF_BINARY" ]; then log "Downloading Jamf binary." curl -ks --connect-timeout 10 --max-time 60 "${JSS_URL}/bin/jamf" -o "$TMP_JAMF" if [ $? -ne 0 ] || [ ! -s "$TMP_JAMF" ]; then log "Download failed. Will retry." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 1 fi chmod +x "$TMP_JAMF" JAMF_BINARY="$TMP_JAMF" fi "$JAMF_BINARY" createConf -url "$JSS_URL" >> "$LOG" 2>&1 log "Initiating Jamf framework enrollment." echo $((attempts + 1)) > "$ATTEMPT_FILE" "$JAMF_BINARY" enroll -invitation "$INVITATION_CODE" -jssUrl "$JSS_URL" >> "$LOG" 2>&1 log "Enrollment command finished with exit code $?." ``` ```bash chmod 755 /usr/local/bin/jamf-enroll.sh ``` -------------------------------- ### List VMs with Short JSON Output Flag Source: https://docs.macstadium.com/orka/orka3-cli-reference/output-formats-and-getting-help Use the short flag '-o json' to get a list of virtual machines in JSON format. ```bash orka3 vm list -o json ``` -------------------------------- ### Install Homebrew and Ruby Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-homebrew Installs Homebrew, then sets up rbenv and ruby-build for managing Ruby versions. It configures bash to load rbenv and installs Ruby version 2.4.2, setting it as the global default. ```bash /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install rbenv ruby-build # Add rbenv to bash so that it loads every time you open a terminal echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile source ~/.bash_profile # Install Ruby rbenv install 2.4.2 rbenv global 2.4.2 ruby -v ``` -------------------------------- ### Install CocoaPods using RubyGems Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-homebrew Installs CocoaPods, a dependency manager for Swift and Objective-C projects. ```bash sudo gem install cocoapods ``` -------------------------------- ### Resize VM Disk with Automatic Repartition (Intel-only) Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example for Intel-based VMs demonstrating how to resize a VM disk and provide SSH credentials for automatic repartitioning. ```bash # (Intel-only) Resize with automatic repartition orka3 vm resize small-intel-vm 100 --user admin --password admin ``` -------------------------------- ### Suspend VM in Specific Namespace Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of suspending a VM within a specified namespace. ```bash # Suspend a VM in a specific namespace orka3 vm suspend small-ventura-vm --namespace orka-test ``` -------------------------------- ### Stop VM in Specific Namespace Example Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-lifecycle-management Example of powering off a VM within a specified namespace. ```bash # Power OFF a VM in a specific namespace orka3 vm stop small-ventura-vm --namespace orka-test ``` -------------------------------- ### Create AVD with Custom Settings Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/android-virtual-devices Create an AVD with custom configurations for platform, image type, CPU, and memory allocation. ```bash ansible-playbook deploy_avd.yml -i inventory -e "vm_name=my-vm" -e "platform=android-34" -e "image_type=google_apis" -e "cpu=4" -e "memory=2048" ``` -------------------------------- ### OrkaNode CRD Example Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-orka3-crd-reference Example of an OrkaNode CRD definition, showing node details and status. ```yaml apiVersion: orka.macstadium.com/v1 kind: OrkaNode metadata: creationTimestamp: "2023-10-16T09:55:25Z" generation: 1 labels: kubernetes.io/arch: amd64 name: mini-25 namespace: orka-default ownerReferences: - apiVersion: v1 blockOwnerDeletion: true controller: true kind: Node name: mini-25 uid: 5bde48ba-a951-46c6-814e-6147cca52dca resourceVersion: "3052" uid: dade0833-c06e-45ac-86ec-67abba759d96 spec: namespace: orka-default tags: [] status: allocatableCpu: 12 allocatableGpu: 0 allocatableMemory: 62.56G availableCpu: 12 availableGpu: 0 availableMemory: 62.56G nodeIP: 10.221.188.35 nodeType: WORKER phase: READY ``` -------------------------------- ### RemoteIso CRD Example Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-orka3-crd-reference Example of a RemoteIso CRD definition, specifying an ISO name and size. ```yaml apiVersion: orka.macstadium.com/v1 kind: RemoteIso metadata: creationTimestamp: "2023-10-16T09:55:25Z" generation: 1 name: ventura.iso namespace: orka-default resourceVersion: "3092" uid: 25de0e37-e99d-4dde-9931-c5d6a872166e spec: isoName: Ventura.iso size: 16G ``` -------------------------------- ### RemoteImage CRD Example Source: https://docs.macstadium.com/orka/kubernetes-native/k8s-native-orka3-crd-reference Example of a RemoteImage CRD definition, specifying an image name and size. ```yaml apiVersion: orka.macstadium.com/v1 kind: RemoteImage metadata: creationTimestamp: "2023-10-16T09:55:25Z" generation: 1 labels: kubernetes.io/arch: amd64 name: 90gbventurassh.img namespace: orka-default resourceVersion: "3095" uid: 29d907bc-e284-487b-8352-8466f89c8568 spec: imageName: 90GBVenturaSSH.img size: 90G ``` -------------------------------- ### Check Intune Enrollment Logs and Status Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment Use these commands to verify the Intune enrollment process on a provisioned VM. The first command checks the launch daemon logs, and the second confirms the MDM profile installation. ```bash # Check what the LaunchDaemon did cat /var/log/intune-enroll.log # Confirm MDM profile was installed after the user approved profiles status -type enrollment ``` -------------------------------- ### Create Jamf Enrollment LaunchDaemon Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This XML plist configures a LaunchDaemon to run the Jamf enrollment script at startup. Ensure the label matches your reverse-domain identifier. Place this file at `/Library/LaunchDaemons/com.yourcompany.jamf-enroll.plist`. ```xml Label com.yourcompany.jamf-enroll ProgramArguments /bin/bash /usr/local/bin/jamf-enroll.sh RunAtLoad StartInterval 300 StandardOutPath /var/log/jamf-enroll.log StandardErrorPath /var/log/jamf-enroll.log ``` -------------------------------- ### Install Citrix VDA Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/ansible-playbook-implementation Installs Citrix Virtual Delivery Agent on a running VM, including prerequisites and TCC permissions. Requires `sshpass` on the Ansible runner and recommends hosting the installer in an S3 bucket with a presigned URL. ```bash ansible-playbook -i inventory install_citrix_vda.yml -e "vm_name=" -e "vm_username=" -e "vm_password=" -e "citrix_installer_url=" -e "hostname_suffix=" ``` -------------------------------- ### List VM configurations in JSON format Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration Retrieve information about available VM configurations formatted as JSON. ```bash orka3 vmc list --output json ``` -------------------------------- ### Verify Orka Engine Installation Source: https://docs.macstadium.com/remote-desktop-vdi/getting-started/msdc-hosted Run these commands to confirm that Orka Engine is installed and accessible on all hosts. ```bash ansible hosts -i inventory -m shell -a "orka-engine --version" ``` ```bash ansible hosts -i inventory -m shell -a "/usr/local/bin/orka-engine info" ``` -------------------------------- ### Install Orka3 CLI with Homebrew Source: https://docs.macstadium.com/orka/quick-start-guides/orka3-cli-quick-start If you are using Homebrew on macOS, you can install the Orka3 CLI using this command. ```bash brew install orka3 ``` -------------------------------- ### Install latest Node.js with Homebrew Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-homebrew Installs the most recent version of Node.js using the Homebrew package manager. ```bash brew install node ``` -------------------------------- ### Create a VM Image Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/image-management Use this playbook to create a new VM image. Ensure configuration scripts are placed in the `/scripts` directory and will be executed alphabetically. ```ansible ansible-playbook -i inventory create_image.yml -e "vm_image=ghcr.io/macstadium/orka-images/sonoma:latest" -e "remote_image_name=registry.example.com/citrix-vda/sonoma-golden:v1.0" ``` ```bash scripts=( 01_install_dotnet.sh 02_install_citrix_vda.sh 03_configure_system.sh ) ``` -------------------------------- ### Install fastlane using RubyGems Source: https://docs.macstadium.com/iaas/cisco-firewalls/network-firewalls-for-ci-build-node-homebrew Installs the fastlane tool for automating mobile app deployments and releases. ```bash sudo gem install fastlane -NV ``` -------------------------------- ### Create Iru Enrollment Script Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This script runs at boot via LaunchDaemon to verify network prerequisites for Iru enrollment and monitors enrollment state. It self-removes once MDM enrollment is confirmed. Ensure the IRU_ENDPOINT is correct and network connectivity is available. ```bash mkdir -p /usr/local/bin ``` ```bash #!/bin/bash # Runs at boot via LaunchDaemon. Verifies network prerequisites for Iru # enrollment and monitors enrollment state. Self-removes once MDM enrollment # is confirmed. IRU_ENDPOINT="https://kandji.io" DAEMON_PLIST="/Library/LaunchDaemons/com.yourcompany.iru-enroll.plist" LOG="/var/log/iru-enroll.log" MAX_ATTEMPTS=10 ATTEMPT_FILE="/var/tmp/.iru-enroll-attempts" log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $1" >> "$LOG" } attempts=0 [ -f "$ATTEMPT_FILE" ] && attempts=$(cat "$ATTEMPT_FILE") if [ "$attempts" -ge "$MAX_ATTEMPTS" ]; then log "Max attempts ($MAX_ATTEMPTS) reached. Verify network and Iru endpoint reachability." exit 1 fi if profiles status -type enrollment 2>/dev/null | grep -q "MDM enrollment: Yes"; then log "MDM enrolled. Cleaning up LaunchDaemon." launchctl unload "$DAEMON_PLIST" 2>/dev/null rm -f "$DAEMON_PLIST" "/usr/local/bin/iru-enroll.sh" "$ATTEMPT_FILE" exit 0 fi network_ready=false for i in $(seq 1 12); do if curl -s --connect-timeout 5 -o /dev/null "${IRU_ENDPOINT}"; then network_ready=true break fi log "Waiting for network... attempt $i" sleep 5 fi if [ "$network_ready" = false ]; then log "Network not available. Will retry at next interval." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 1 fi log "Prerequisites OK. Awaiting user login to complete enrollment via Iru enrollment URL." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 0 ``` -------------------------------- ### Ansible Inventory Example Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/ansible-playbook-implementation An example of an Ansible inventory file listing the IP addresses of target hosts. ```yaml [hosts] 10.0.0.31 10.0.0.32 10.0.0.33 ``` -------------------------------- ### Orka CLI VM Deploy Targeted Examples Source: https://docs.macstadium.com/orka/orka3-cli-reference/vm-deployment-and-configuration Illustrates deploying VMs to specific nodes, namespaces, or with node affinity tags, and using different schedulers. ```bash # Deploy on a selected node orka3 vm deploy -i 90gbventurassh.orkasi --node mini-arm-14 ``` ```bash # Deploy on a selected node in a specific namespace orka3 vm deploy -i 90gbventurassh.orkasi --node mini-arm-14 --namespace orka-test ``` ```bash # Deploy in a specific namespace orka3 vm deploy -i 90gbventurassh.orkasi --namespace orka-test ``` ```bash # Deploy with flexible node affinity orka3 vm deploy -i 90gbventurassh.orkasi --tag jenkins-builds --tag-required=false ``` ```bash # Deploy with strict node affinity orka3 vm deploy -i 90gbventurassh.orkasi --tag jenkins-builds --tag-required=true ``` ```bash # Deploy using the most-allocated scheduler orka3 vm deploy -i 90gbventurassh.orkasi --scheduler most-allocated ``` -------------------------------- ### Create Intune Enrollment LaunchDaemon Script Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This bash script, placed at `/usr/local/bin/intune-enroll.sh`, runs at boot via LaunchDaemon. It verifies network reachability to the Intune endpoint and checks for the presence of the Company Portal app. It also monitors enrollment status and self-removes once MDM enrollment is confirmed. The script includes logging and retry mechanisms for network or installation issues. ```bash mkdir -p /usr/local/bin ``` ```bash #!/bin/bash # Runs at boot via LaunchDaemon. Verifies prerequisites for Intune enrollment # (network reachability and Company Portal presence) and monitors enrollment # state. The actual MDM profile install is a user-driven step handled by the # LaunchAgent. Self-removes once MDM enrollment is confirmed. INTUNE_ENDPOINT="https://manage.microsoft.com" COMPANY_PORTAL_APP="/Applications/Company Portal.app" DAEMON_PLIST="/Library/LaunchDaemons/com.yourcompany.intune-enroll.plist" LOG="/var/log/intune-enroll.log" MAX_ATTEMPTS=10 ATTEMPT_FILE="/var/tmp/.intune-enroll-attempts" log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $1" >> "$LOG" } attempts=0 [ -f "$ATTEMPT_FILE" ] && attempts=$(cat "$ATTEMPT_FILE") if [ "$attempts" -ge "$MAX_ATTEMPTS" ]; then log "Max attempts ($MAX_ATTEMPTS) reached. Verify Company Portal install and tenant reachability." exit 1 fi if profiles status -type enrollment 2>/dev/null | grep -q "MDM enrollment: Yes"; then log "MDM enrolled. Cleaning up LaunchDaemon." launchctl unload "$DAEMON_PLIST" 2>/dev/null rm -f "$DAEMON_PLIST" "/usr/local/bin/intune-enroll.sh" "$ATTEMPT_FILE" exit 0 fi network_ready=false for i in $(seq 1 12); do if curl -s --connect-timeout 5 -o /dev/null -w "%{http_code}" "${INTUNE_ENDPOINT}" | grep -qE "^(200|301|302|400|401|403)$"; then network_ready=true break fi log "Waiting for network... attempt $i" sleep 5 done if [ "$network_ready" = false ]; then log "Network not available or Intune endpoint unreachable. Will retry at next interval." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 1 fi if [ ! -d "$COMPANY_PORTAL_APP" ]; then log "ERROR: Company Portal.app not found at $COMPANY_PORTAL_APP. Re-seal the golden image with Company Portal installed." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 1 fi log "Prerequisites OK. Awaiting user login to complete enrollment via Company Portal." echo $((attempts + 1)) > "$ATTEMPT_FILE" exit 0 ``` -------------------------------- ### OCI Image Naming Convention Example Source: https://docs.macstadium.com/orka/oci-images/orka-self-service-migrating-nfs-images-to-oci-with-harbor Example of a consistent, semantic naming convention for OCI images in Harbor. ```text /library/-: (e.g. 10.221.189.254/library/sequoia-xcode16:v1.0) ``` -------------------------------- ### Create Iru Enrollment Prompt Script Source: https://docs.macstadium.com/remote-desktop-vdi/configuration/mdm-enrollment This script runs at login via LaunchAgent to prompt the user to complete MDM enrollment via the Iru enrollment URL. It cleans itself up once enrollment is confirmed. Replace 'YOUR_IRU_ENROLLMENT_URL' with your actual enrollment URL. ```bash #!/bin/bash # Runs at login via LaunchAgent. Prompts the user to complete MDM enrollment # via the Iru enrollment URL. Cleans itself up once enrollment is confirmed. IRU_ENROLLMENT_URL="https://yourcompany.kandji.io/enroll/access-code/YOUR_ENROLLMENT_CODE" AGENT_PLIST="/Library/LaunchAgents/com.yourcompany.iru-enroll-prompt.plist" if profiles status -type enrollment 2>/dev/null | grep -q "MDM enrollment: Yes"; then launchctl unload "$AGENT_PLIST" 2>/dev/null rm -f "$AGENT_PLIST" "/usr/local/bin/iru-enroll-prompt.sh" exit 0 fi button=$(osascript <