Files
ansible/list_proxmox.yml
2024-06-14 08:40:04 +02:00

53 lines
1.4 KiB
YAML

---
- name: List VMs, Templates, and ISOs on Proxmox
hosts: proxmox.localdomain
gather_facts: no
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: no
register: vms_info
- name: Print VM info
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: no
register: nodes_info
- name: Print node info
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: no
storage: local
node: "{{ proxmox_node }}"
register: isos_info
- name: Print ISO info
debug:
var: isos_info