refactor ♻️: Refactor logrotate configuration for better organization and maintainability.
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 6s
Gitleaks Scan / gitleaks (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 37s
Markdown Lint / markdown-lint (push) Successful in 5s
ansible-lint / Ansible Lint (pull_request) Failing after 6s
Gitleaks Scan / gitleaks (pull_request) Successful in 4s
Markdown Lint / markdown-lint (pull_request) Successful in 5s
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 6s
Gitleaks Scan / gitleaks (push) Successful in 5s
ai-reviews / Review PR (pull_request) Successful in 37s
Markdown Lint / markdown-lint (push) Successful in 5s
ansible-lint / Ansible Lint (pull_request) Failing after 6s
Gitleaks Scan / gitleaks (pull_request) Successful in 4s
Markdown Lint / markdown-lint (pull_request) Successful in 5s
This commit refactors the logrotate configuration by installing and customizing policies, replacing the logrotate command with a service restart in handlers, and adding new templates for Proxmox firewall and general logs. This improves the overall structure and manageability of the logrotate settings.
This commit is contained in:
25
templates/pve-firewall-logrotate.j2
Normal file
25
templates/pve-firewall-logrotate.j2
Normal file
@@ -0,0 +1,25 @@
|
||||
# Managed by Ansible - Proxmox Logrotate Policy
|
||||
# Do not edit manually
|
||||
|
||||
/var/log/pve-firewall.log { {
|
||||
rotate {{ proxmox_logrotate_rotate }}
|
||||
{{ proxmox_logrotate_frequency }}
|
||||
maxsize {{ proxmox_logrotate_maxsize }}
|
||||
{% if proxmox_logrotate_compress %}
|
||||
compress
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_delaycompress %}
|
||||
delaycompress
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_missingok %}
|
||||
missingok
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_notifempty %}
|
||||
notifempty
|
||||
{% endif %}
|
||||
sharedscripts
|
||||
create 640 root adm
|
||||
postrotate
|
||||
invoke-rc.d pvefw-logger restart 2>/dev/null >/dev/null || true
|
||||
endscript
|
||||
}
|
||||
26
templates/pve-logrotate.j2
Normal file
26
templates/pve-logrotate.j2
Normal file
@@ -0,0 +1,26 @@
|
||||
# Managed by Ansible - Proxmox Logrotate Policy
|
||||
# Do not edit manually
|
||||
|
||||
/var/log/pveproxy/access.log {
|
||||
rotate {{ proxmox_logrotate_rotate }}
|
||||
{{ proxmox_logrotate_frequency }}
|
||||
maxsize {{ proxmox_logrotate_maxsize }}
|
||||
{% if proxmox_logrotate_compress %}
|
||||
compress
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_delaycompress %}
|
||||
delaycompress
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_missingok %}
|
||||
missingok
|
||||
{% endif %}
|
||||
{% if proxmox_logrotate_notifempty %}
|
||||
notifempty
|
||||
{% endif %}
|
||||
create 640 www-data www-data
|
||||
sharedscripts
|
||||
postrotate
|
||||
/bin/systemctl try-reload-or-restart pveproxy.service
|
||||
/bin/systemctl try-reload-or-restart spiceproxy.service
|
||||
endscript
|
||||
}
|
||||
Reference in New Issue
Block a user