679e170dce
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2625|6|2619|7|:+1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/376//ansiblelint">Evolix » ansible-roles » unstable #376</a>
gitea/ansible-roles/pipeline/head This commit looks good
91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
---
|
|
|
|
# TODO: voir comment faire des backups initiaux des fichiers
|
|
|
|
# RSyslog
|
|
- name: Copy rsyslog evolinux defaut conf
|
|
ansible.builtin.copy:
|
|
src: logs/rsyslog.d/10-evolinux-default.conf
|
|
dest: /etc/rsyslog.d/10-evolinux-default.conf
|
|
mode: "0644"
|
|
notify: restart rsyslog
|
|
when: evolinux_logs_rsyslog_conf | bool
|
|
|
|
# Logrotate
|
|
- name: Disable logrotate default conf
|
|
ansible.builtin.command:
|
|
cmd: mv /etc/logrotate.d/rsyslog /etc/logrotate.d/rsyslog.disabled
|
|
args:
|
|
removes: /etc/logrotate.d/rsyslog
|
|
creates: /etc/logrotate.d/rsyslog.disabled
|
|
notify: restart rsyslog
|
|
when: evolinux_logs_disable_logrotate_rsyslog | bool
|
|
|
|
- name: Copy many logrotate files
|
|
ansible.builtin.copy:
|
|
src: logs/logrotate.d/
|
|
dest: /etc/logrotate.d/
|
|
when: evolinux_logs_logrotate_confs | bool
|
|
|
|
- name: Copy rsyslog logrotate file
|
|
ansible.builtin.template:
|
|
src: logs/zsyslog.j2
|
|
dest: /etc/logrotate.d/zsyslog
|
|
when: evolinux_logs_logrotate_confs | bool
|
|
|
|
- name: Configure logrotate.conf default rotate value
|
|
ansible.builtin.replace:
|
|
dest: /etc/logrotate.conf
|
|
regexp: "rotate [0-9]+"
|
|
replace: "rotate 12"
|
|
when: evolinux_logs_default_rotate | bool
|
|
|
|
- name: Enable logrotate.conf dateext option
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/logrotate.conf
|
|
line: "dateext"
|
|
regexp: "^#?\\s*dateext"
|
|
when: evolinux_logs_default_dateext | bool
|
|
|
|
- name: Enable logrotate.conf dateformat option
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/logrotate.conf
|
|
line: "dateformat {{ evolinux_logrotate_dateformat | mandatory }}"
|
|
regexp: "^#?\\s*dateformat.*"
|
|
insertafter: 'dateext'
|
|
when: evolinux_logs_default_dateext | bool
|
|
|
|
- name: Disable logrotate.conf dateyesterday option
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/logrotate.conf
|
|
line: "# dateyesterday"
|
|
regexp: "^\\s*dateyesterday"
|
|
insertafter: 'dateext'
|
|
when: evolinux_logs_default_dateext | bool
|
|
|
|
# Logcheck
|
|
- name: Disable logcheck monitoring of journald
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/logrotate.conf
|
|
line: "#journal"
|
|
regexp: "^journal"
|
|
when: evolinux_logs_disable_logcheck_journald | bool
|
|
|
|
# Journald
|
|
- name: /etc/systemd/journald.conf.d/ is present
|
|
ansible.builtin.file:
|
|
path: /etc/systemd/journald.conf.d/
|
|
state: directory
|
|
mode: "0755"
|
|
when: evolinux_logs_journald_conf | bool
|
|
|
|
- name: Copy journald.conf
|
|
ansible.builtin.copy:
|
|
src: logs/journald.conf
|
|
dest: /etc/systemd/journald.conf.d/00-evolinux-default.conf
|
|
mode: "0644"
|
|
notify: restart systemd-journald
|
|
when: evolinux_logs_journald_conf | bool
|
|
|
|
- ansible.builtin.meta: flush_handlers
|