Git initial commit
This commit is contained in:
commit
3a460d9cad
9
LICENSE
Executable file
9
LICENSE
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
3
README.md
Executable file
3
README.md
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# cloud-php
|
||||||
|
|
||||||
|
Ansible role to provide php, e.g. used for nginx or wordpress.
|
||||||
46
defaults/main.yml
Executable file
46
defaults/main.yml
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
cloud_apps: /opt
|
||||||
|
cloud_storage: /opt/storage
|
||||||
|
cloud_stage: prod
|
||||||
|
cloud_update: false
|
||||||
|
|
||||||
|
|
||||||
|
php_version: 8.0
|
||||||
|
|
||||||
|
php_modules: []
|
||||||
|
|
||||||
|
php_memory_limit: 128M
|
||||||
|
php_upload_max_filesize: 2M
|
||||||
|
php_post_max_size: 8M
|
||||||
|
|
||||||
|
php_opcache_interned_strings_buffer: 8
|
||||||
|
php_opcache_save_comments: 1
|
||||||
|
php_opcache_revalidate_freq: 2
|
||||||
|
php_opcache_validate_timestamps: 1
|
||||||
|
|
||||||
|
# see: https://spot13.com/pmcalculator/
|
||||||
|
php_pm_max_children: 102
|
||||||
|
php_pm_start_servers: 25
|
||||||
|
php_pm_min_spare_servers: 25
|
||||||
|
php_pm_max_spare_servers: 76
|
||||||
|
|
||||||
|
|
||||||
|
php_fpm_config: []
|
||||||
|
# - key: upload_max_filesize
|
||||||
|
# value: 2M
|
||||||
|
|
||||||
|
php_fpm_poolconf: []
|
||||||
|
# - key: pm.max_children
|
||||||
|
# value: 102
|
||||||
|
|
||||||
|
php_fpm_poolconf_env:
|
||||||
|
- key: HOSTNAME
|
||||||
|
value: $HOSTNAME
|
||||||
|
- key: PATH
|
||||||
|
value: /usr/local/bin:/usr/bin:/bin
|
||||||
|
- key: TMP
|
||||||
|
value: /tmp
|
||||||
|
- key: TMPDIR
|
||||||
|
value: /tmp
|
||||||
|
- key: TEMP
|
||||||
|
value: /tmp
|
||||||
5
handlers/main.yml
Executable file
5
handlers/main.yml
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: restart php-fpm
|
||||||
|
service:
|
||||||
|
name: "php{{ php_version }}-fpm"
|
||||||
|
state: restarted
|
||||||
15
meta/main.yml
Executable file
15
meta/main.yml
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
role_name: php
|
||||||
|
namespace: hahn-cloud
|
||||||
|
author: Lars Hahn
|
||||||
|
company: OpenDevChain
|
||||||
|
license: MIT
|
||||||
|
description: Role to setup PHP; should be used in combination with an DB-, HTTP-Server.
|
||||||
|
platforms:
|
||||||
|
- name: Debian
|
||||||
|
versions:
|
||||||
|
- 11
|
||||||
|
galaxy_tags:
|
||||||
|
- php
|
||||||
|
dependencies: []
|
||||||
66
tasks/main.yml
Executable file
66
tasks/main.yml
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
- name: install requirements for php repository
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
pkg:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- gnupg2
|
||||||
|
- lsb-release
|
||||||
|
- libmagickcore-6.q16-6-extra # SVG for imagick php module
|
||||||
|
|
||||||
|
- name: install PHP sury repository key
|
||||||
|
apt_key:
|
||||||
|
url: https://packages.sury.org/php/apt.gpg
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: install PHP sury repository
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: install PHP and recommendations
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
|
||||||
|
install_recommends: yes
|
||||||
|
pkg: "{{ php_modules + php_modules_base }}"
|
||||||
|
|
||||||
|
- name: configure PHP fpm
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ php_path }}/fpm/php.ini"
|
||||||
|
regexp: '^(;|){{ item.key }} = '
|
||||||
|
line: "{{ item.key }} = {{ item.value }}"
|
||||||
|
loop: "{{ php_fpm_config + php_fpm_config_default }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
notify: restart php-fpm
|
||||||
|
|
||||||
|
- name: configure PHP fpm pool conf
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ php_path }}/fpm/pool.d/www.conf"
|
||||||
|
regexp: '^(;|){{ item.key }} = '
|
||||||
|
line: "{{ item.key }} = {{ item.value }}"
|
||||||
|
loop: "{{ php_fpm_poolconf + php_fpm_poolconf_default }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
notify: restart php-fpm
|
||||||
|
|
||||||
|
- name: configure PHP fpm env pool conf
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ php_path }}/fpm/pool.d/www.conf"
|
||||||
|
regexp: '^(;|)env\[{{ item.key }}\] = '
|
||||||
|
line: "env[{{ item.key }}] = {{ item.value }}"
|
||||||
|
loop: "{{ php_fpm_poolconf_env }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
notify: restart php-fpm
|
||||||
|
|
||||||
|
- name: configure PHP apcu availability
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ php_path }}/mods-available/apcu.ini"
|
||||||
|
regexp: '^(;\s*|)apc.enable_cli='
|
||||||
|
line: "apc.enable_cli=1"
|
||||||
|
notify: restart php-fpm
|
||||||
53
vars/main.yml
Executable file
53
vars/main.yml
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
#a rather good selection for most apps
|
||||||
|
php_modules_base:
|
||||||
|
- "php{{ php_version }}-apcu"
|
||||||
|
- "php{{ php_version }}-bz2"
|
||||||
|
- "php{{ php_version }}-ctype"
|
||||||
|
- "php{{ php_version }}-curl"
|
||||||
|
- "php{{ php_version }}-dom"
|
||||||
|
- "php{{ php_version }}-fpm"
|
||||||
|
- "php{{ php_version }}-fileinfo"
|
||||||
|
- "php{{ php_version }}-gd"
|
||||||
|
- "php{{ php_version }}-gmp"
|
||||||
|
- "php{{ php_version }}-imagick"
|
||||||
|
- "php{{ php_version }}-intl"
|
||||||
|
- "php{{ php_version }}-mbstring"
|
||||||
|
- "php{{ php_version }}-memcached"
|
||||||
|
- "php{{ php_version }}-mysql"
|
||||||
|
- "php{{ php_version }}-pdo-pgsql"
|
||||||
|
- "php{{ php_version }}-posix"
|
||||||
|
- "php{{ php_version }}-redis"
|
||||||
|
- "php{{ php_version }}-simplexml"
|
||||||
|
- "php{{ php_version }}-xmlreader"
|
||||||
|
- "php{{ php_version }}-xmlwriter"
|
||||||
|
- "php{{ php_version }}-zip"
|
||||||
|
|
||||||
|
|
||||||
|
php_path: "/etc/php/{{ php_version }}"
|
||||||
|
|
||||||
|
php_fpm_config_default:
|
||||||
|
- key: memory_limit
|
||||||
|
value: "{{ php_memory_limit }}"
|
||||||
|
- key: upload_max_filesize
|
||||||
|
value: "{{ php_upload_max_filesize }}"
|
||||||
|
- key: post_max_size
|
||||||
|
value: "{{ php_post_max_size }}"
|
||||||
|
- key: opcache.interned_strings_buffer
|
||||||
|
value: "{{ php_opcache_interned_strings_buffer }}"
|
||||||
|
- key: opcache.save_comments
|
||||||
|
value: "{{ php_opcache_save_comments }}"
|
||||||
|
- key: opcache.revalidate_freq
|
||||||
|
value: "{{ php_opcache_revalidate_freq }}"
|
||||||
|
- key: opcache.validate_timestamps
|
||||||
|
value: "{{ php_opcache_validate_timestamps }}"
|
||||||
|
|
||||||
|
php_fpm_poolconf_default:
|
||||||
|
- key: pm.max_children
|
||||||
|
value: "{{ php_pm_max_children }}"
|
||||||
|
- key: pm.start_servers
|
||||||
|
value: "{{ php_pm_start_servers }}"
|
||||||
|
- key: pm.min_spare_servers
|
||||||
|
value: "{{ php_pm_min_spare_servers }}"
|
||||||
|
- key: pm.max_spare_servers
|
||||||
|
value: "{{ php_pm_max_spare_servers }}"
|
||||||
Loading…
Reference in New Issue
Block a user