nginx: Add custom logrotate script for OpenBSD
This commit is contained in:
parent
04b98d5b7f
commit
d9b6c2d27f
1 changed files with 21 additions and 8 deletions
|
@ -70,15 +70,28 @@
|
|||
group: "{{ ansible_wheel }}"
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Fix rotating access.log
|
||||
ansible.builtin.lineinfile:
|
||||
- name: Disable web logs from newsyslog
|
||||
ansible.builtin.replace:
|
||||
path: /etc/newsyslog.conf
|
||||
regexp: "^{{ item }}\\s"
|
||||
line: |-
|
||||
{{ '{:<40}'.format(item) }}644 7 * $D0 Z /var/run/nginx.pid
|
||||
with_items:
|
||||
- /var/www/logs/access.log
|
||||
- /var/www/logs/error.log
|
||||
regexp: "^/var/www/logs/"
|
||||
replace: "#/var/www/logs/"
|
||||
when: ansible_system == "OpenBSD"
|
||||
|
||||
- name: Install logrotate script
|
||||
ansible.builtin.copy:
|
||||
dest: /usr/local/bin/nginx-logrotate
|
||||
src: nginx-logrotate.sh
|
||||
mode: "0755"
|
||||
owner: root
|
||||
group: "{{ ansible_wheel }}"
|
||||
when: ansible_system == "OpenBSD"
|
||||
|
||||
- name: Add logrotate cron job
|
||||
ansible.builtin.cron:
|
||||
name: nginx-logrotate
|
||||
hour: "0"
|
||||
minute: "0"
|
||||
job: /usr/local/bin/nginx-logrotate
|
||||
when: ansible_system == "OpenBSD"
|
||||
|
||||
- name: Enable nginx service
|
||||
|
|
Loading…
Add table
Reference in a new issue