diff --git a/roles/common/files/sysstat-default b/roles/common/files/sysstat-default new file mode 100644 index 00000000..1b029ba6 --- /dev/null +++ b/roles/common/files/sysstat-default @@ -0,0 +1,9 @@ +# +# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat +# and /etc/cron.daily/sysstat files +# + +# Should sadc collect system activity informations? Valid values +# are "true" and "false". Please do not put other values, they +# will be overwritten by debconf! +ENABLED="true" diff --git a/roles/common/files/sysstat.conf b/roles/common/files/sysstat.conf new file mode 100644 index 00000000..e983b0f1 --- /dev/null +++ b/roles/common/files/sysstat.conf @@ -0,0 +1,31 @@ +# sysstat configuration file. See sysstat(5) manual page. + +# How long to keep log files (in days). +# Used by sa2(8) script +# If value is greater than 28, then log files are kept in +# multiple directories, one for each month. +HISTORY=28 + +# Compress (using xz, gzip or bzip2) sa and sar files older than (in days): +COMPRESSAFTER=7 + +# Parameters for the system activity data collector (see sadc(8) manual page) +# which are used for the generation of log files. +# By default contains the `-S DISK' option responsible for generating disk +# statisitcs. Use `-S XALL' to collect all available statistics. +SADC_OPTIONS="-S XALL" + +# Directory where sa and sar files are saved. +SA_DIR=/var/log/sysstat + +# Compression program to use. +ZIP="xz" + +# By default sa2 script generates yesterday's summary, since the cron job +# usually runs right after midnight. If you want sa2 to generate the summary +# of the same day (for example when cron job runs at 23:53) set this variable. +#YESTERDAY=no + +# By default sa2 script generates reports files (the so called sarDD files). +# Set this variable to false to disable reports generation. +#REPORTS=false diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index 41f7b654..f0351051 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -708,5 +708,8 @@ - include: munin-node.yml +- include: sysstat.yml + - include: ntp.yml when: "not 'vm' in group_names" + diff --git a/roles/common/tasks/sysstat.yml b/roles/common/tasks/sysstat.yml new file mode 100644 index 00000000..e43237af --- /dev/null +++ b/roles/common/tasks/sysstat.yml @@ -0,0 +1,17 @@ +- name: install packages for sysstat + apt: pkg={{ item }} update_cache=yes + with_items: + - sysstat + - xz + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Enable sysstat + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + mode: "{{ item.mode }}" + loop: + - { src: 'sysstat-default', dest: '/etc/default/sysstat', mode: '0644' } + - { src: 'sysstat.conf', dest: '/etc/sysstat/sysstat', mode: '0644' } + notify: restart sysstat