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 }}"
|
group: "{{ ansible_wheel }}"
|
||||||
when: ansible_os_family == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
|
|
||||||
- name: Fix rotating access.log
|
- name: Disable web logs from newsyslog
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.replace:
|
||||||
path: /etc/newsyslog.conf
|
path: /etc/newsyslog.conf
|
||||||
regexp: "^{{ item }}\\s"
|
regexp: "^/var/www/logs/"
|
||||||
line: |-
|
replace: "#/var/www/logs/"
|
||||||
{{ '{:<40}'.format(item) }}644 7 * $D0 Z /var/run/nginx.pid
|
when: ansible_system == "OpenBSD"
|
||||||
with_items:
|
|
||||||
- /var/www/logs/access.log
|
- name: Install logrotate script
|
||||||
- /var/www/logs/error.log
|
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"
|
when: ansible_system == "OpenBSD"
|
||||||
|
|
||||||
- name: Enable nginx service
|
- name: Enable nginx service
|
||||||
|
|
Loading…
Add table
Reference in a new issue