fix 🐛: Fix typo and add file permission in logrotate.yml task #7
@@ -15,6 +15,6 @@
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reexec: true
|
||||
|
||||
- name: logrotate reload
|
||||
- name: Logrotate reload
|
||||
ansible.builtin.command: logrotate /etc/logrotate.conf
|
||||
changed_when: false
|
||||
|
||||
@@ -13,98 +13,98 @@
|
||||
|
||||
block:
|
||||
|
||||
- name: Check if {{ item }} exists
|
||||
- name: logrotate | Check if {{ item }} exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
register: logrotate_file
|
||||
|
||||
- name: Configure {{ item }}
|
||||
- name: logrotate | Configure {{ item }}
|
||||
when: logrotate_file.stat.exists
|
||||
block:
|
||||
|
||||
- name: Backup {{ item }} once
|
||||
- name: logrotate | Backup {{ item }} once
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ item }}.original"
|
||||
owner: root
|
||||
group: root
|
||||
remote_src: true
|
||||
args:
|
||||
creates: "{{ item }}.original"
|
||||
|
||||
- name: Ensure daily rotation
|
||||
- name: logrotate | Ensure daily rotation
|
||||
ansible.builtin.replace:
|
||||
path: "{{ item }}"
|
||||
regexp: '^\s*weekly'
|
||||
replace: 'daily'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Set rotate (number of retained logs)
|
||||
- name: logrotate | Set rotate (number of retained logs)
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '^(\s*rotate\s+).*'
|
||||
line: ' rotate {{ proxmox_logrotate_rotate }}'
|
||||
state: present
|
||||
insertafter: '^\s*daily'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Ensure maxsize is set
|
||||
- name: logrotate | Ensure maxsize is set
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '^(\s*maxsize\s+).*'
|
||||
line: ' maxsize {{ proxmox_logrotate_maxsize }}'
|
||||
state: present
|
||||
insertafter: '^\s*rotate'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Ensure Compress
|
||||
- name: logrotate | Ensure Compress
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '^\s*compress\b'
|
||||
line: ' compress'
|
||||
state: present
|
||||
insertafter: '^\s*maxsize'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Ensure delaycompress
|
||||
- name: logrotate | Ensure delaycompress
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ item }}"
|
||||
regexp: '^\s*delaycompress\b'
|
||||
line: ' delaycompress'
|
||||
state: present
|
||||
insertafter: '^\s*compress'
|
||||
notify: logrotate reload
|
||||
|
||||
when: logrotate_file.stat.exists
|
||||
|
||||
notify: Logrotate reload
|
||||
|
||||
# only for logrotate.conf
|
||||
|
||||
- name: Uncomment dateext if commented
|
||||
- name: logrotate | Uncomment dateext if commented
|
||||
ansible.builtin.replace:
|
||||
path: /etc/logrotate.conf
|
||||
regexp: '^\s*#\s*(dateext)\b'
|
||||
replace: '\1'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Uncomment compress if commented
|
||||
- name: logrotate | Uncomment compress if commented
|
||||
ansible.builtin.replace:
|
||||
path: /etc/logrotate.conf
|
||||
regexp: '^\s*#\s*(compress)\b'
|
||||
replace: '\1'
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Ensure missingok is present
|
||||
- name: logrotate | Ensure missingok is present
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/logrotate.conf
|
||||
regexp: '^\s*missingok\b'
|
||||
line: 'missingok'
|
||||
state: present
|
||||
insertafter: EOF
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
- name: Ensure notifempty is present
|
||||
- name: logrotate | Ensure notifempty is present
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/logrotate.conf
|
||||
regexp: '^\s*notifempty\b'
|
||||
line: 'notifempty'
|
||||
state: present
|
||||
insertafter: EOF
|
||||
notify: logrotate reload
|
||||
notify: Logrotate reload
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: Ensure /usr/local/bin exists
|
||||
- name: subscription | Ensure /usr/local/bin exists
|
||||
ansible.builtin.file:
|
||||
path: /usr/local/bin
|
||||
state: directory
|
||||
@@ -21,7 +21,7 @@
|
||||
mode: "0755"
|
||||
|
|
||||
when: proxmoxlib_js.stat.exists
|
||||
|
||||
- name: Install APT post-invoke hook for nag removal
|
||||
- name: subscription | Install APT post-invoke hook for nag removal
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/apt/apt.conf.d/no-nag-script
|
||||
owner: root
|
||||
|
gitea-actions
commented
[Lines 1-27] [Score: 3] The naming convention is inconsistent, using a mix of regular and descriptive task names. This might create confusion about the purpose of each task at a glance. [Lines 1-27] [Score: 3] The naming convention is inconsistent, using a mix of regular and descriptive task names. This might create confusion about the purpose of each task at a glance.
|
||||
|
||||
Reference in New Issue
Block a user
[Lines 6-21] [Score: 4] The script hardcodes a path to the web JavaScript file and checks for its existence using
-s. This approach might fail if the file is not present or if its name changes. Consider usingfindwith appropriate filters instead.