File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ mailman3_core_var_dir: /var/lib/mailman3
3131# Mailman Core logs
3232mailman3_core_log_dir : /var/log/mailman3
3333
34+ # Mailman Web logs (in this case Crons)
35+ mailman3_web_log_dir : /var/log/mailman3-web
36+
3437# Mailman Web Interface configuration files, project, and data
3538mailman3_web_var_dir : " {{ mailman3_core_var_dir }}/web"
3639
@@ -219,6 +222,18 @@ mailman3_logrotate_config:
219222 - su - {{ __mailman3_core_user_name }} -s /bin/sh -c "{{ mailman3_install_dir }}/bin/mailman -C {{ mailman3_core_etc_dir }}/mailman.cfg reopen"
220223 # endscript is automatically appended
221224
225+ # Mailman3 Core log rotation configuration
226+ mailman3_web_logrotate_config :
227+ - weekly
228+ - rotate 4
229+ - compress
230+ - maxsize 100M
231+ - missingok
232+ - notifempty
233+ - sharedscripts
234+ - delaycompress
235+ # endscript is automatically appended
236+
222237#
223238# Mailman Web Interface configuration
224239#
Original file line number Diff line number Diff line change 109109 user : " {{ __mailman3_web_user_name }}"
110110 minute : " {{ item.minute | default(omit) }}"
111111 special_time : " {{ item.special_time | default(omit) }}"
112- job : " MAILMAN_WEB_CONFIG={{ mailman3_django_project_dir }}/settings.py {{ mailman3_install_dir }}/bin/mailman-web runjobs {{ item.name | default(item.special_time) }} > {{ item.name | default(item.special_time) }}.txt 2>&1"
112+ job : " ( date && MAILMAN_WEB_CONFIG={{ mailman3_django_project_dir }}/settings.py {{ mailman3_install_dir }}/bin/mailman-web runjobs {{ item.name | default(item.special_time) }} ) >> {{ mailman3_web_log_dir }}/{{ item.name | default(item.special_time) }}.log 2>&1"
113113 loop :
114114 - special_time : hourly
115115 - special_time : daily
Original file line number Diff line number Diff line change 4747 - path : " {{ mailman3_core_log_dir }}"
4848 owner : " {{ __mailman3_core_user_name }}"
4949 group : " {{ __mailman3_core_group_name }}"
50+ - path : " {{ mailman3_web_log_dir }}"
51+ owner : " {{ __mailman3_web_user_name }}"
52+ group : " {{ __mailman3_web_group_name }}"
5053 mode : " 0755"
5154 - path : " {{ mailman3_web_var_dir }}"
5255 owner : " {{ __mailman3_web_user_name }}"
121124 dest : /etc/logrotate.d/mailman3-core
122125 mode : " 0644"
123126
127+ - name : Install Mailman Web logrotate configuration
128+ ansible.builtin.template :
129+ src : logrotate-mailman3-web.j2
130+ dest : /etc/logrotate.d/mailman3-web
131+ mode : " 0644"
132+
124133# TODO: remove the non-instance service unit file if mailman3_domains is defined, remove the instance service unit file
125134
126135- name : Create Django settings file
Original file line number Diff line number Diff line change 1+ ##
2+ ## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN
3+ ##
4+ {{ mailman3_web_log_dir }}/*.log {
5+ {% for opt in mailman 3_web_logrotate_config %}
6+ {% if opt is mapping %}
7+ {% set key , val = opt .items () | first %}
8+ {{ key }}
9+ {% for subopt in val %}
10+ {{ subopt }}
11+ {% endfor %}
12+ endscript
13+ {% else %}
14+ {{ opt }}
15+ {% endif %}
16+ {% endfor %}
17+ }
You can’t perform that action at this time.
0 commit comments