summaryrefslogtreecommitdiff
path: root/roles/essential/tasks/atop.yml
blob: ccc699c37bd463c73ab3b2e862bd6a2e00736521 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- name: Install atop
  ansible.builtin.package:
    name:
      - atop
    state: present

- name: Setup per-minute atop snapshot
  ansible.builtin.lineinfile:
    dest: /etc/default/atop
    state: present
    regexp: '^#?LOGINTERVAL='
    line: 'LOGINTERVAL=60'
    owner: root
    group: root
    mode: u+rw,g+r,o+r
  notify:
    - Restart atop

- name: Setup logrotate to save 7 days of logs for atop
  ansible.builtin.lineinfile:
    dest: /etc/default/atop
    state: present
    regexp: '^#?LOGGENERATIONS='
    line: 'LOGGENERATIONS=7'
    owner: root
    group: root
    mode: u+rw,g+r,o+r
  notify:
    - Restart atop

- name: Enable atop systemd unit and logrotate timer
  ansible.builtin.service:
    name: '{{ item }}'
    enabled: yes
    state: started
  loop:
    - atop
    - atop-rotate.timer