--- - name: Investigate High CPU hosts: all become: true tasks: - name: Gather information on top CPU consuming processes ansible.builtin.command: cmd: 'ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu' register: processes_cpu - name: Gather information on top Memory consuming processes ansible.builtin.command: cmd: 'ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem' register: processes_mem - name: Dump CPU details ansible.builtin.debug: msg: "{{ lookup('template','../templates/cpuhog_ticket.j2') }}"