ansible-role-php/tasks/user.yml

48 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: "User | Create systemd user"
ansible.builtin.user:
name: "{{ php_user }}"
shell: /bin/false
create_home: "{{ create_home | default('false') }}"
password_lock: true
- name: "User | Add www-data to user group"
ansible.builtin.user:
name: www-data
groups: "{{ php_user }}"
append: true
- name: "User | Create log file"
ansible.builtin.file:
path: "{{ php_fpm_log_dir }}/{{ php_user }}.log"
state: touch
owner: "{{ php_user }}"
group: "{{ php_user }}"
2023-06-10 23:45:48 +02:00
mode: "0644"
2023-02-08 11:32:15 +01:00
# Pool configuration for initial use
# Don't override local changes
- name: "User | Create PHP-FPM pool"
ansible.builtin.template:
2023-11-01 08:08:21 +01:00
src: fpmpool.cfg.j2
dest: "/etc/php/{{ php_version.stdout }}/fpm/pool.d/{{ php_user }}.cfg"
2023-02-08 11:32:15 +01:00
force: false
2023-06-10 23:45:48 +02:00
mode: "0644"
notify:
- stop php-fpm-socket
- stop php-fpm-service
- start php-fpm-socket
- name: "User | Enable systemd socket"
ansible.builtin.systemd:
name: "php-fpm@{{ php_user }}.socket"
enabled: true
state: started
daemon_reload: true
- name: "User | Enable systemd service"
ansible.builtin.systemd:
name: "php-fpm@{{ php_user }}.service"
enabled: true
daemon-reload: true