ansible-role-php/tasks/user.yml

47 lines
1.2 KiB
YAML

---
- 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 }}"
mode: 0644
# Pool configuration for initial use
# Don't override local changes
- name: "User | Create PHP-FPM pool"
ansible.builtin.template:
src: fpmpool.cfg
dest: "/etc/php/{{ php_version.stdout }}/fpm/pool.d/{{ php_user }}.cfg"
force: false
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