--- - name: Install QEMU Guest Agent hosts: all become: yes tasks: - name: Update package cache apt: update_cache: yes when: ansible_os_family == "Debian" - name: Install QEMU Guest Agent on Debian/Ubuntu apt: name: qemu-guest-agent state: present when: ansible_os_family == "Debian" - name: Enable and start QEMU Guest Agent service systemd: name: qemu-guest-agent enabled: yes state: started - name: Ensure QEMU Guest Agent is running service: name: qemu-guest-agent state: started # This playbook will: # # Update the package cache on Debian-based systems. # Install the QEMU Guest Agent on Debian/Ubuntu systems. # Enable and start the QEMU Guest Agent service. # Ensure the QEMU Guest Agent is running. # # You can save this as a YAML file (e.g., install_qemu_guest_agent.yml) and run it using the command: # Command: ansible-playbook -i inventory.ini qemuagentinstall.yml -K #-K is for BECOME sudo password