Add php-fpm user and group for log file ownership

This commit introduces the php-fpm user and group, assigning ownership of relevant log files to ensure proper permissions. Updates were also made to the logrotate configuration to include the `su` directive for php-fpm. These changes improve compatibility and address log management requirements.
This commit is contained in:
Julien Fastré 2025-01-13 11:35:45 +01:00
parent edf09e16c2
commit 41531016aa
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 17 additions and 2 deletions

View File

@ -28,13 +28,26 @@
username: "{{ docker_hub_username }}"
password: "{{ docker_hub_token }}"
- name: Create group php-fpm on host (require to store logs)
ansible.builtin.group:
gid: 82
name: php-fpm
system: true
- name: Create user php-fpm on host (required to store logs)
ansible.builtin.user:
uid: 82
group: php-fpm
name: php-fpm
create_home: false
system: true
- name: Create log directory
ansible.builtin.file:
path: /var/log/chill
state: directory
owner: 33
group: 33
owner: php-fpm
group: php-fpm
mode: '0774'
- name: Configure logrotate for chill

View File

@ -1,4 +1,5 @@
/var/log/chill/default-*.log {
su php-fpm php-fpm
rotate 90
daily
compress
@ -7,6 +8,7 @@
}
/var/log/apt/private-*.log {
su php-fpm php-fpm
rotate 180
daily
compress