Co-authored-by: MKletz <michael.kletz.27@gmail.com> Co-authored-by: Ajay Chenampara <ajay.chenampara@gmail.com> Co-authored-by: dlemons-redhat <69318976+dlemons-redhat@users.noreply.github.com> Co-authored-by: Nicolas Leiva <nicolasleiva@gmail.com> Co-authored-by: benblasco <42140583+benblasco@users.noreply.github.com> Co-authored-by: Benjamin Blasco <bblasco@redhat.com> Co-authored-by: calvingsmith <4283930+calvingsmith@users.noreply.github.com> Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com> Co-authored-by: Hicham Mourad <43329991+HichamMourad@users.noreply.github.com>
30 lines
821 B
YAML
30 lines
821 B
YAML
---
|
|
- name: Gather debug info
|
|
hosts: "{{ _hosts | default(omit) }}"
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Gather recent vmstat info # noqa: no-changed-when
|
|
ansible.builtin.command: /bin/vmstat 1 5
|
|
register: vmstat
|
|
|
|
- name: Gather top CPU hogs # noqa: no-changed-when
|
|
ansible.builtin.command: ps -eo user,pid,size,pcpu,cmd --sort=-pcpu
|
|
register: pscpu
|
|
|
|
- name: Gather top memory hogs # noqa: no-changed-when
|
|
ansible.builtin.command: ps -eo user,pid,size,pcpu,cmd --sort=-size
|
|
register: pssize
|
|
|
|
- name: Swap + wait states
|
|
ansible.builtin.debug:
|
|
var: vmstat.stdout_lines
|
|
|
|
- name: Top 3 CPU hogs
|
|
ansible.builtin.debug:
|
|
var: pscpu.stdout_lines[:4]
|
|
|
|
- name: Top 3 memory hogs
|
|
ansible.builtin.debug:
|
|
var: pssize.stdout_lines[:4]
|