darexsu.php
Rola Ansible dla PHP 7.x, 8.x
- Rola:
- Playbooki (wersja scalania):
- Playbooki (pełna wersja):
Platformy
Testowanie | repo: dystrybucja | repo: third_party |
---|---|---|
Debian 11 | PHP 7.4 | Sury |
Debian 10 | PHP 7.3 | Sury |
Ubuntu 20.04 | PHP 7.4 | ppa:andrej |
Ubuntu 18.04 | PHP 7.2 | ppa:andrej |
Oracle Linux 8 | PHP 7.2-7.4 | Remi |
Rocky Linux 8 | PHP 7.2-7.4 | Remi |
Instalacja
ansible-galaxy install darexsu.php --force
Zachowanie scalania
Zastąp lub scal słowniki (z "hash_behaviour=replace" w ansible.cfg):
# Zastąp # Scal
--- ---
vars: vars:
dict: merge:
a: "wartość" dict:
b: "wartość" a: "wartość"
b: "wartość"
# Jak działa scalanie?:
Twoje zmienne [host_vars] --> domyślne zmienne [aktualna rola] --> domyślne zmienne [dołączona rola]
dict: dict: dict:
a: "1" --> a: "1" --> a: "1"
b: "2" --> b: "2"
c: "3"
zainstaluj i skonfiguruj: PHP (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
# PHP -> konfiguracja -> php.ini
php_ini:
enabled: true
file: "php.ini"
src: "php_ini.j2"
backup: false
data:
php:
max_execution_time: "30"
max_input_time: "60"
memory_limit: "128M"
upload_max_filesize: "2M"
# PHP -> konfiguracja -> php.fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
unix_socket:
enabled: true
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: PHP, repozytorium: dystrybucja (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "dystrybucja"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: PHP, repozytorium: third_party (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "8.0"
repo: "third_party"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: moduły PHP (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> instalacja
php_install:
enabled: true
# PHP -> instalacja -> instalacja niestandardowych modułów
modules: [common, fpm, gd]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: php.ini (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> php.ini
php_ini:
enabled: true
data:
php:
engine: "On"
short_open_tag: "Off"
precision: "14"
output_buffering: "4096"
zlib_output_compression: "Off"
implicit_flush: "Off"
# ...
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: gniazdo tcpip php-fpm (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
# PHP -> konfiguracja -> pula php-fpm -> włącz gniazdo tcp/ip
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
# PHP -> konfiguracja -> pula php-fpm -> wyłącz gniazdo unix
unix_socket:
enabled: false
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: gniazdo unix php-fpm (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
# PHP -> konfiguracja -> pula php-fpm -> wyłącz gniazdo tcp/ip
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
# PHP -> konfiguracja -> pula php-fpm -> włącz gniazdo unix
unix_socket:
enabled: true
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: dodaj wiele konfiguracji (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
# PHP -> konfiguracja -> pula php-fpm -> usuń www.conf
www_conf:
enabled: true
state: "absent"
# PHP -> konfiguracja -> pula php-fpm -> dodaj new.conf
first_conf:
enabled: true
file: "first.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php{{ php.version }}-first-fpm.sock"
user: "www-data"
group: "www-data"
# PHP -> konfiguracja -> pula php-fpm -> dodaj second.conf
second_conf:
enabled: true
file: "second.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php{{ php.version }}-second-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj i skonfiguruj: PHP (pełna wersja)
---
- hosts: all
become: true
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
service:
enabled: true
state: "started"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
# PHP -> konfiguracja -> php.ini
php_ini:
enabled: true
file: "php.ini"
src: "php_ini.j2"
backup: false
data:
php:
engine: "On"
short_open_tag: "Off"
precision: "14"
output_buffering: "4096"
zlib_output_compression: "Off"
implicit_flush: "Off"
unserialize_callback_func: ""
serialize_precision: "-1"
disable_functions: ""
disable_classes: ""
zend_enable_gc: ""
zend_exception_ignore_args: "On"
zend_exception_string_param_max_len: "0"
expose_php: "On"
max_execution_time: "30"
max_input_time: "60"
memory_limit: "128M"
error_reporting: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
display_errors: "Off"
display_startup_errors: "Off"
log_errors: "On"
log_errors_max_len: "1024"
ignore_repeated_errors: "Off"
ignore_repeated_source: "Off"
report_memleaks: "On"
variables_order: "GPCS"
request_order: "GP"
register_argc_argv: "Off"
auto_globals_jit: "On"
post_max_size: "8M"
auto_prepend_file: ""
auto_append_file: ""
default_mimetype: "text/html"
default_charset: "UTF-8"
doc_root: ""
user_dir: ""
enable_dl: "Off"
file_uploads: "On"
upload_max_filesize: "2M"
max_file_uploads: "20"
allow_url_fopen: "On"
allow_url_include: "Off"
default_socket_timeout: "60"
# PHP -> konfiguracja -> php.fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
src: "php_fpm.j2"
backup: false
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: PHP, repozytorium: dystrybucja (pełna wersja)
---
- hosts: all
become: true
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "dystrybucja"
service:
enabled: true
state: "started"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: PHP, repozytorium: third_party (pełna wersja)
---
- hosts: all
become: true
vars:
# PHP
php:
enabled: true
version: "8.0"
repo: "third_party"
service:
enabled: true
state: "started"
# PHP -> instalacja
php_install:
enabled: true
modules: [common, fpm]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
zainstaluj: moduły PHP (pełna wersja)
---
- hosts: all
become: true
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
service:
enabled: true
state: "started"
# PHP -> instalacja
php_install:
enabled: true
# PHP -> instalacja -> instalacja niestandardowych modułów
modules: [common, fpm, gd]
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: php.ini (pełna wersja)
---
- hosts: all
become: true
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
service:
enabled: true
state: "started"
# PHP -> konfiguracja -> php.ini
php_ini:
enabled: true
file: "php.ini"
src: "php_ini.j2"
backup: false
data:
php:
engine: "On"
short_open_tag: "Off"
precision: "14"
output_buffering: "4096"
zlib_output_compression: "Off"
implicit_flush: "Off"
unserialize_callback_func: ""
serialize_precision: "-1"
disable_functions: ""
disable_classes: ""
zend_enable_gc: ""
zend_exception_ignore_args: "On"
zend_exception_string_param_max_len: "0"
expose_php: "On"
max_execution_time: "30"
max_input_time: "60"
memory_limit: "128M"
error_reporting: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
display_errors: "Off"
display_startup_errors: "Off"
log_errors: "On"
log_errors_max_len: "1024"
ignore_repeated_errors: "Off"
ignore_repeated_source: "Off"
report_memleaks: "On"
variables_order: "GPCS"
request_order: "GP"
register_argc_argv: "Off"
auto_globals_jit: "On"
post_max_size: "8M"
auto_prepend_file: ""
auto_append_file: ""
default_mimetype: "text/html"
default_charset: "UTF-8"
doc_root: ""
user_dir: ""
enable_dl: "Off"
file_uploads: "On"
upload_max_filesize: "2M"
max_file_uploads: "20"
allow_url_fopen: "On"
allow_url_include: "Off"
default_socket_timeout: "60"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: gniazdo tcpip php-fpm (pełna wersja)
---
- hosts: all
become: yes
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
# PHP -> konfiguracja -> pula php-fpm -> włącz gniazdo tcp/ip
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
# PHP -> konfiguracja -> pula php-fpm -> wyłącz gniazdo unix
unix_socket:
enabled: false
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: gniazdo unix php-fpm (pełna wersja)
---
- hosts: all
become: yes
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
www_conf:
enabled: true
file: "www.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
# PHP -> konfiguracja -> pula php-fpm -> wyłącz gniazdo tcp/ip
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
# PHP -> konfiguracja -> pula php-fpm -> włącz gniazdo unix
unix_socket:
enabled: true
file: "php{{ php.version }}-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php
skonfiguruj: dodaj wiele konfiguracji (pełna wersja)
---
- hosts: all
become: yes
vars:
# PHP
php:
enabled: true
version: "7.4"
repo: "third_party"
# PHP -> konfiguracja -> pula php-fpm
php_fpm:
# PHP -> konfiguracja -> pula php-fpm -> usuń www.conf
www_conf:
enabled: true
state: "absent"
# PHP -> konfiguracja -> pula php-fpm -> dodaj new.conf
first_conf:
enabled: true
file: "first.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php{{ php.version }}-first-fpm.sock"
user: "www-data"
group: "www-data"
# PHP -> konfiguracja -> pula php-fpm -> dodaj second.conf
second_conf:
enabled: true
file: "second.conf"
state: "present"
src: "php_fpm.j2"
backup: true
data:
webserver_user: "www-data"
webserver_group: "www-data"
pm: "dynamic"
pm_max_children: "10"
pm_start_servers: "5"
pm_min_spare_servers: "5"
pm_max_spare_servers: "5"
pm_max_requests: "500"
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php{{ php.version }}-second-fpm.sock"
user: "www-data"
group: "www-data"
tasks:
- name: dołącz rolę darexsu.php
include_role:
name: darexsu.php