Skip to content

Commit

Permalink
enable systemd for sysstat
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Jan 18, 2024
1 parent 121e39b commit 81426d5
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions roles/diagnostic/tasks/setup_sysstat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,35 @@

- name: Enable data collection
when: sysstat_enable_data_collecting
ansible.builtin.lineinfile:
dest: /etc/default/sysstat
regexp: '^ENABLED=.*'
line: 'ENABLED="true"'
block:
- name: Enable default
ansible.builtin.lineinfile:
dest: /etc/default/sysstat
regexp: '^ENABLED=.*'
line: 'ENABLED="true"'

- name: Enable sysstat service
when: sysstat_enable_data_collecting
ansible.builtin.systemd:
name: sysstat
state: started
enabled: true

- name: Disable data collection
when: not sysstat_enable_data_collecting
ansible.builtin.lineinfile:
dest: /etc/default/sysstat
regexp: '^ENABLED=.*'
line: 'ENABLED="false"'
block:
- name: Disable default
ansible.builtin.lineinfile:
dest: /etc/default/sysstat
regexp: '^ENABLED=.*'
line: 'ENABLED="false"'

- name: Enable sysstat service
when: sysstat_enable_data_collecting
ansible.builtin.systemd:
name: sysstat
state: stopped
enabled: false

- name: Disabled sysstat
when: not diagnostic_with_sysstat
Expand Down

0 comments on commit 81426d5

Please sign in to comment.