Files
operating-automation/roles/proxmox-automation/tasks/get-vmid.yaml
2026-04-14 11:38:07 +02:00

19 lines
566 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
retries: 3
delay: 10
until: vm_info is succeeded
timeout: 60
- name: Extract VMID
ansible.builtin.set_fact:
vmid: "{{ vm_info.proxmox_vms[0].vmid }}"