Skip to content

Commit db8f500

Browse files
committed
ansible: Install atop on Debian based hosts and default to 10s intervals
atop is useful to be able to debug what happened historically.
1 parent 1878716 commit db8f500

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

ansible/roles/base/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
---
22
__base_packages:
3+
- atop
34
- curl
45
- git
56
- jq
67
- python3-pip
78
- vim
9+
10+
atop_interval: 10

ansible/roles/base/tasks/setup-Debian.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,45 @@
1616
state: stopped
1717
enabled: no
1818
masked: yes
19+
20+
# When atopacct is running, it holds semaphore that prevent atop from working
21+
# Further troubleshooting would need to be done, but atop can do just fine on its own.
22+
# Note that even stopping `atopacct` leaves semaphores... either reboot or clean them
23+
# manually.
24+
# Possibly related: https://lkml.org/lkml/2016/12/19/182
25+
- name: Disable atopacct
26+
become: true
27+
ansible.builtin.service:
28+
name: atopacct
29+
state: stopped
30+
enabled: false
31+
32+
- name: Setup atop
33+
become: true
34+
ansible.builtin.copy:
35+
dest: "/etc/default/atop"
36+
content: |
37+
# This file is generated by Ansible, do not modify
38+
LOGOPTS="-R"
39+
LOGINTERVAL={{ atop_interval }}
40+
LOGGENERATIONS=28
41+
LOGPATH=/var/log/atop
42+
mode: 0644
43+
owner: root
44+
group: root
45+
register: atop_conf
46+
47+
48+
- name: Start and Enable atop
49+
become: yes
50+
ansible.builtin.service:
51+
name: atop
52+
state: started
53+
enabled: yes
54+
55+
- name: restart atop
56+
become: yes
57+
service:
58+
name: atop
59+
state: restarted
60+
when: atop_conf.changed

0 commit comments

Comments
 (0)