php/tasks/main.yml

56 lines
2.3 KiB
YAML
Raw Permalink Normal View History

2019-04-14 14:49:30 +00:00
---
- name: Ensure php is installed.
2021-08-18 17:29:38 +00:00
package:
2019-04-14 14:49:30 +00:00
name:
- php
- php-fpm
2020-02-16 15:22:01 +00:00
- php-intl
2020-04-14 18:34:50 +00:00
- php-imagick
2020-09-06 19:26:10 +00:00
- php-pgsql
2019-04-14 14:49:30 +00:00
state: present
become: yes
2020-03-02 20:19:36 +00:00
2019-04-14 14:49:30 +00:00
- name: Ensure php-fpm is started and enabled to start at boot.
2020-03-02 20:19:36 +00:00
service: name=php-fpm enabled=yes
2019-04-14 14:49:30 +00:00
become: yes
2020-11-07 16:10:12 +00:00
- name: enable php extention
2019-04-14 14:49:30 +00:00
become: true
2020-11-07 16:10:12 +00:00
lineinfile:
2019-04-14 14:49:30 +00:00
dest: /etc/php/php.ini
2019-04-15 11:38:47 +00:00
regexp: "^;extension={{item}}$"
2020-11-07 16:10:12 +00:00
line: "extension={{item}}"
2019-04-14 14:49:30 +00:00
with_items: "{{php_extention_enable}}"
2020-02-16 15:22:01 +00:00
notify: reload_php_fpm
2020-11-07 16:10:12 +00:00
- name: enable php zend_extention
become: true
lineinfile:
dest: /etc/php/php.ini
regexp: "^;zend_extention={{item}}$"
line: "zend_extention={{item}}"
with_items: "{{php_zend_extention_enable}}"
notify: reload_php_fpm
2020-02-16 15:22:01 +00:00
- name: Set PHP memory limit
become: true
lineinfile:
dest: /etc/php/php.ini
regexp: "memory_limit ="
line: "memory_limit = {{php_memory_limit}}"
- name: create custom systemd folder
file:
path: /etc/systemd/system/php-fpm.service.d/ # required. Path to the file being managed.
state: directory # not required. choices: absent;directory;file;hard;link;touch. If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line).
become: yes
- name: apply override file for systemd
template:
dest: /etc/systemd/system/php-fpm.service.d/override.conf # required. Location to render the template to on the remote machine.
src: override.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
notify: "reload_php_fpm"
become: yes