52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
---
|
|
- name: List VMs, Templates, and ISOs on Proxmox
|
|
hosts: proxmox.localdomain
|
|
gather_facts: false
|
|
vars:
|
|
api_host: 192.168.1.162
|
|
api_user: root@pam
|
|
api_token_id: mytoki
|
|
api_token_secret: ea5114f5-ed39-4277-ac09-a32984be5bc9
|
|
proxmox_node: pve # Add your Proxmox node name here
|
|
tasks:
|
|
- name: List all VMs
|
|
community.general.proxmox_vm_info:
|
|
api_host: "{{ api_host }}"
|
|
api_user: "{{ api_user }}"
|
|
api_token_id: "{{ api_token_id }}"
|
|
api_token_secret: "{{ api_token_secret }}"
|
|
validate_certs: false
|
|
register: vms_info
|
|
|
|
- name: Print VM info
|
|
ansible.builtin.debug:
|
|
var: vms_info
|
|
|
|
- name: List all nodes
|
|
community.general.proxmox_node_info:
|
|
api_host: "{{ api_host }}"
|
|
api_user: "{{ api_user }}"
|
|
api_token_id: "{{ api_token_id }}"
|
|
api_token_secret: "{{ api_token_secret }}"
|
|
validate_certs: false
|
|
register: nodes_info
|
|
|
|
- name: Print node info
|
|
ansible.builtin.debug:
|
|
var: nodes_info
|
|
|
|
- name: List all ISOs
|
|
community.general.proxmox_storage_contents_info:
|
|
api_host: "{{ api_host }}"
|
|
api_user: "{{ api_user }}"
|
|
api_token_id: "{{ api_token_id }}"
|
|
api_token_secret: "{{ api_token_secret }}"
|
|
validate_certs: false
|
|
storage: local
|
|
node: "{{ proxmox_node }}"
|
|
register: isos_info
|
|
|
|
- name: Print ISO info
|
|
ansible.builtin.debug:
|
|
var: isos_info
|