--- - name: Gather Proxmox VM and LXC information hosts: proxmox gather_facts: false tasks: - name: Get list of KVM virtual machines ansible.builtin.shell: | qm list register: qm_list_output changed_when: false - name: Get list of LXC containers ansible.builtin.shell: | pct list register: pct_list_output changed_when: false - name: Ensure log directory exists on local machine ansible.builtin.file: path: "{{ playbook_dir }}/logs" state: directory delegate_to: localhost run_once: true - name: Write VM list to local log file ansible.builtin.copy: content: "{{ qm_list_output.stdout }}" dest: "{{ playbook_dir }}/logs/{{ inventory_hostname }}_vms.log" delegate_to: localhost - name: Write LXC list to local log file ansible.builtin.copy: content: "{{ pct_list_output.stdout }}" dest: "{{ playbook_dir }}/logs/{{ inventory_hostname }}_lxcs.log" delegate_to: localhost