Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: Install atop on Debian based hosts and default to 10s intervals #105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/roles/base/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
__base_packages:
- atop
- curl
- git
- jq
- python3-pip
- vim

atop_interval: 10
42 changes: 42 additions & 0 deletions ansible/roles/base/tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,45 @@
state: stopped
enabled: no
masked: yes

# When atopacct is running, it holds semaphore that prevent atop from working
# Further troubleshooting would need to be done, but atop can do just fine on its own.
# Note that even stopping `atopacct` leaves semaphores... either reboot or clean them
# manually.
# Possibly related: https://lkml.org/lkml/2016/12/19/182
- name: Disable atopacct
become: true
ansible.builtin.service:
name: atopacct
state: stopped
enabled: false

- name: Setup atop
become: true
ansible.builtin.copy:
dest: "/etc/default/atop"
content: |
# This file is generated by Ansible, do not modify
LOGOPTS="-R"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a long option?

LOGINTERVAL={{ atop_interval }}
LOGGENERATIONS=28
LOGPATH=/var/log/atop
mode: 0644
owner: root
group: root
register: atop_conf


- name: Start and Enable atop
become: yes
ansible.builtin.service:
name: atop
state: started
enabled: yes

- name: restart atop
become: yes
service:
name: atop
state: restarted
when: atop_conf.changed
Loading