Files
operating-automation/roles/proxmox-automation/tasks/get-vmid.yaml
2025-11-19 11:23:50 +01:00

15 lines
497 B
YAML

- name: Retrieve information about specific VM by name and get current configuration
community.proxmox.proxmox_vm_info:
api_host: "{{ proxmox_host }}"
api_user: "{{ proxmox_user }}"
api_token_id: "{{ proxmox_token_id }}"
api_token_secret: "{{ proxmox_token_secret }}"
type: all
name: "{{ inventory_hostname }}"
config: current
register: vm_info
delegate_to: localhost
- name: Extract VMID
ansible.builtin.set_fact:
vmid: "{{ vm_info.proxmox_vms[0].vmid }}"