---
# Provision a new OpenClaw VM from scratch on the hypervisor host.
#
# This playbook runs on localhost (the hypervisor) and:
#   1. Downloads the Ubuntu cloud image (cached)
#   2. Creates the VM disk image
#   3. Builds a cloud-init seed ISO for first-boot configuration
#   4. Defines the VM XML (EFI, memfd, virtiofs, TPM, watchdog)
#   5. Configures a static DHCP reservation
#   6. Enables autostart and starts the VM
#   7. Waits for SSH
#
# After this playbook completes, run:
#   ansible-playbook -i inventory.yml playbooks/install.yml   --limit <instance>
#   ansible-playbook -i inventory.yml playbooks/customize.yml --limit <instance>
#   ~/lab/swarm/restore-openclaw-vm.sh <instance>   # to restore config from backup
#
# Usage:
#   ansible-playbook -i inventory.yml playbooks/provision-vm.yml --limit zap

- name: Provision OpenClaw VM
  hosts: openclaw_servers
  connection: local
  become: false

  vars:
    ansible_python_interpreter: /usr/bin/python3

  roles:
    - vm
