Skip to content

Commit

Permalink
The definitive solution for sysstat
Browse files Browse the repository at this point in the history
  • Loading branch information
hufhend committed May 9, 2024
1 parent 6b47309 commit a3a818f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
13 changes: 2 additions & 11 deletions roles/orangepi/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,8 @@

when: not swap_file_check.stat.exists

- name: Shorten history for sysstat
ansible.builtin.lineinfile:
path: /etc/sysstat/sysstat
regexp: '^HISTORY=7'
line: 'HISTORY=3'

- name: Keep history for sysstat
ansible.builtin.lineinfile:
path: /etc/sysstat/sysstat
regexp: '^COMPRESSAFTER=10'
line: 'COMPRESSAFTER=1'
- name: Include tasks sysstat services
include_tasks: "{{ role_path }}/tasks/sysstat.yaml"

- name: Install Git packages
ansible.builtin.apt:
Expand Down
42 changes: 42 additions & 0 deletions roles/orangepi/tasks/sysstat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- name: Shorten history for sysstat
ansible.builtin.lineinfile:
path: /etc/sysstat/sysstat
regexp: '^HISTORY=7'
line: 'HISTORY=3'

- name: Keep history for sysstat
ansible.builtin.lineinfile:
path: /etc/sysstat/sysstat
regexp: '^COMPRESSAFTER=10'
line: 'COMPRESSAFTER=1'

- name: Create a sysstat directory
ansible.builtin.file:
path: /var/sysstat
state: directory
owner: root
group: root
mode: '0755'

# sysstat.service simply cannot be in the zram
- name: Change directory for sysstat
ansible.builtin.lineinfile:
path: /etc/sysstat/sysstat
regexp: '^SA_DIR=/var/log/sysstat'
line: 'SA_DIR=/var/sysstat'

- name: Ensure old sysstat is absent
ansible.builtin.file:
path: /var/log/sysstat
state: absent

- name: Create link to new sysstat
ansible.builtin.file:
src: /var/sysstat
dest: /var/log/sysstat
state: link

- name: Restart system activity logs
ansible.builtin.systemd:
name: sysstat.service
state: restarted

0 comments on commit a3a818f

Please sign in to comment.