commit c80cb694822763f65b9bc4bd09d72d134ed322e3 Author: vincent Date: Sat Feb 6 10:26:14 2021 +0100 add PHP7 for compatibility tt-rss and nextcloud diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..73f95b0 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,4 @@ +php_extention_enable: [] +php_memory_limit: 256M +PHP_ReadWritePaths: [] +php_zend_extention_enable: [] \ No newline at end of file diff --git a/files/main.yml b/files/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..ad5d556 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: reload_php_fpm + service: name=php-fpm7 state=restarted + become: yes \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..350a4a0 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,57 @@ +--- +- name: Ensure php is installed. + pacman: + name: + - "php7" + - "php7-fpm" + - "php7-intl" + - "php7-imagick" + - "php7-pgsql" + state: present + become: yes + +- name: Ensure php-fpm is started and enabled to start at boot. + service: + name: php-fpm7 + enabled: yes + become: yes + +- name: enable php extention + become: true + lineinfile: + dest: /etc/php7/php.ini + regexp: "^;extension={{item}}$" + line: "extension={{item}}" + with_items: "{{php_extention_enable}}" + notify: reload_php_fpm + +- name: enable php zend_extention + become: true + lineinfile: + dest: /etc/php7/php.ini + regexp: "^;zend_extention={{item}}$" + line: "zend_extention={{item}}" + with_items: "{{php_zend_extention_enable}}" + notify: reload_php_fpm + +- name: Set PHP memory limit + become: true + lineinfile: + dest: /etc/php7/php.ini + regexp: "memory_limit =" + line: "memory_limit = {{php_memory_limit}}" + + +- name: create custom systemd folder + file: + path: /etc/systemd/system/php-fpm7.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-fpm7.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 diff --git a/templates/main.yml b/templates/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/templates/override.j2 b/templates/override.j2 new file mode 100644 index 0000000..eede234 --- /dev/null +++ b/templates/override.j2 @@ -0,0 +1,4 @@ +[Service] +{% for item in PHP_ReadWritePaths %} + ReadWritePaths= {{ item }} +{% endfor %} diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..e69de29