--- # Deploy one standalone Ubuntu 24.04 VM on a specific Proxmox host. # # Usage: # ansible-playbook -i inventory/hosts.ini playbooks/proxmox/deploy_standalone_ubuntu_vm.yml \ # -e "target_host=pve02 standalone_vm_vmid=5210" - name: Deploy standalone Ubuntu VM on Proxmox hosts: "{{ target_host | default('standalone_vm_host_undefined') }}" gather_facts: true vars: standalone_vm_name: "statler" standalone_vm_memory_mb: 10240 standalone_vm_cores: 2 standalone_vm_disk_size: "32G" standalone_vm_ip_cidr: "10.0.0.210/24" standalone_vm_gateway: "10.0.0.2" standalone_vm_dns_servers: - "10.0.0.2" - "8.8.8.8" pre_tasks: - name: Validate standalone VM playbook scope ansible.builtin.assert: that: - target_host is defined - target_host | length > 0 - target_host not in ['all', '*', 'proxmox_cluster', 'standalone_vm_host_undefined'] - standalone_vm_vmid is defined - (standalone_vm_vmid | int) > 0 fail_msg: "Provide an explicit Proxmox host and VMID. Example: -e 'target_host=pve02 standalone_vm_vmid=5210'" success_msg: "Standalone VM playbook scope validated." run_once: true delegate_to: localhost tags: ['preflight', 'validate'] roles: - role: statler vars: statler_vm_name: "{{ standalone_vm_name }}" statler_vm_vmid: "{{ standalone_vm_vmid | int }}" statler_vm_memory_mb: "{{ standalone_vm_memory_mb | int }}" statler_vm_cores: "{{ standalone_vm_cores | int }}" statler_vm_disk_size: "{{ standalone_vm_disk_size }}" statler_vm_ip_cidr: "{{ standalone_vm_ip_cidr }}" statler_vm_gateway: "{{ standalone_vm_gateway }}" statler_vm_dns_servers: "{{ standalone_vm_dns_servers }}" post_tasks: - name: Show follow-up onboarding command ansible.builtin.debug: msg: - "Provisioning finished for {{ standalone_vm_name }} at {{ standalone_vm_ip_cidr }}." - "Next: ansible-playbook -i inventory/hosts.ini playbooks/onboarding/generic_host.yml -e 'target_host={{ standalone_vm_name }} onboarding_profile=new'" run_once: true tags: ['summary']