123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- - name: 'Install common PHP dependencies (Debian <= 8)'
- apt:
- pkg: '{{ item }}'
- state: 'installed'
- with_items:
- - 'php5-cli'
- - 'php5-curl'
- - 'php5-gd'
- - 'php5-intl'
- - 'php5-mcrypt'
- - 'php-mime-type'
- - 'php5-pgsql'
- - 'php5-sqlite'
- when: with_php and ansible_lsb.major_release|int <= 8
- - name: 'Install common PHP dependencies (Debian >= 9)'
- apt:
- pkg: '{{ item }}'
- state: 'installed'
- with_items:
- - 'php{{ php_version }}-cli'
- - 'php{{ php_version }}-curl'
- - 'php{{ php_version }}-gd'
- - 'php{{ php_version }}-intl'
- - 'php{{ php_version }}-mcrypt'
- - 'php{{ php_version }}-mysql'
- - 'php{{ php_version }}-pgsql'
- - 'php{{ php_version }}-sqlite3'
- when: with_php and ansible_lsb.major_release|int >= 9
- - name: 'Create PHP log directory'
- file:
- path: '/var/log/php'
- state: directory
- owner: 'root'
- group: 'root'
- mode: 0755
- when: with_fpm
- - name: 'Install PHP configuration for syslog'
- template:
- src: '{{ item.src }}'
- dest: '{{ item.dest }}'
- owner: 'root'
- group: 'root'
- mode: 0644
- with_items:
- - { src: 'rsyslog/php-errors.conf.j2', dest: '/etc/rsyslog.d/php-errors.conf' }
- - { src: 'logrotate/php-errors.j2', dest: '/etc/logrotate.d/php-errors' }
- notify:
- - 'Reload rsyslog for php'
- when: with_fpm
- - name: 'Install local PHP configuration overrides for php5-cli (Debian 8)'
- template:
- src: 'php/php-config-cli.ini.j2'
- dest: '/etc/php5/cli/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_php and ansible_lsb.major_release|int == 8
- - name: 'Install local PHP configuration overrides for php{{ php_version }}-cli (Debian >= 9)'
- template:
- src: 'php/php-config-cli.ini.j2'
- dest: '/etc/php/{{php_version }}/cli/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_php and ansible_lsb.major_release|int >= 9
- - name: 'Install Apache2 module for php5'
- apt:
- pkg: 'libapache2-mod-php5'
- state: 'installed'
- when: with_modphp5
- - name: 'Install Apache2 module for php{{ php_version }}'
- apt:
- pkg: 'libapache2-mod-php{{php_version}}'
- state: 'installed'
- when: with_modphp
- - name: 'Install local PHP configuration (Debian < 8)'
- template:
- src: 'php/php-config-web.ini.j2'
- dest: '/etc/php5/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_modphp5 and ansible_lsb.major_release|int < 8
- - name: 'Install local PHP configuration for Apache 2 (Debian 8)'
- template:
- src: 'php/php-config-web.ini.j2'
- dest: '/etc/php5/apache2/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_modphp5 and ansible_lsb.major_release|int == 8
- - name: 'Install local PHP configuration for Apache 2 (Debian >= 9)'
- template:
- src: 'php/php-config-web.ini.j2'
- dest: '/etc/php/{{ php_version }}/apache2/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_modphp5 and ansible_lsb.major_release|int >= 9
- - name: 'Create system checks directory /etc/phpsyscheck'
- file:
- path: '/etc/phpsyscheck'
- state: 'directory'
- owner: 'root'
- group: 'root'
- mode: 0755
- - name: 'Install phpinfo system check'
- template:
- src: 'php/phpinfo.php'
- dest: '/etc/phpsyscheck/index.php'
- owner: 'root'
- group: 'root'
- mode: 0644
- - name: 'Install PHP APC extension (Debian <= 8)'
- apt:
- pkg: 'php-apc'
- state: 'installed'
- when: with_php_apc and ansible_lsb.major_release|int <= 8
- - name: 'Install PHP APC extension (Debian >= 9)'
- apt:
- pkg: 'php-apcu'
- state: 'installed'
- when: with_php_apc and ansible_lsb.major_release|int >= 9
- - name: 'Install php-apc system check'
- template:
- src: 'php/apc.php'
- dest: '/etc/phpsyscheck/apc.php'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_php_apc
- - name: 'Install MySQL extension for PHP - native driver (Debian 8)'
- apt:
- pkg: 'php5-mysqlnd'
- state: 'installed'
- when: not with_php_mysql_legacy and ansible_lsb.major_release|int == 8
- - name: 'Install MySQL extension for PHP (old driver)'
- apt:
- pkg: 'php5-mysql'
- state: 'installed'
- when: with_php_mysql_legacy
- - name: 'Install PHPMyAdmin'
- apt:
- pkg: 'phpmyadmin'
- state: 'installed'
- when: with_phpmyadmin
- - name: 'Install PHPPgAdmin'
- apt:
- pkg: 'phppgadmin'
- state: 'installed'
- when: with_phppgadmin
- - name: 'Install FPM for PHP 5 (Debian <= 8)'
- apt:
- pkg: 'php5-fpm'
- state: 'installed'
- when: with_fpm and ansible_lsb.major_release|int <= 8
- - name: 'Install FPM for PHP {{ php_version }} (Debian >= 9)'
- apt:
- pkg: 'php{{ php_version }}-fpm'
- state: 'installed'
- when: with_fpm and ansible_lsb.major_release|int >= 9
- - name: 'Configure FPM for PHP 5 (Debian <= 8)'
- lineinfile:
- dest: '/etc/php5/fpm/php-fpm.conf'
- regexp: '^{{item.key}}\s*=.*$'
- line: '{{item.key}} = {{item.value}}'
- insertafter: '^;{{item.key}}'
- with_items:
- - { key: 'error_log', value: 'syslog' }
- - { key: 'log_level', value: 'warning' }
- - { key: 'emergency_restart_threshold', value: '100' }
- - { key: 'emergency_restart_interval', value: '5s' }
- - { key: 'rlimit_files', value: '262144' }
- - { key: 'events.mechanism', value: 'epoll' }
- - { key: 'include', value: '/etc/php5/fpm/pool.d/local-pool.cnf' }
- notify:
- - 'Reload FPM for PHP 5'
- when: with_fpm and ansible_lsb.major_release|int <= 8
- - name: 'Configure FPM for PHP {{ php_version }} (Debian >= 9)'
- lineinfile:
- dest: '/etc/php/{{ php_version }}/fpm/php-fpm.conf'
- regexp: '^{{item.key}}\s*=.*$'
- line: '{{item.key}} = {{item.value}}'
- insertafter: '^;{{item.key}}'
- with_items:
- - { key: 'error_log', value: 'syslog' }
- - { key: 'log_level', value: 'warning' }
- - { key: 'emergency_restart_threshold', value: '100' }
- - { key: 'emergency_restart_interval', value: '5s' }
- - { key: 'rlimit_files', value: '262144' }
- - { key: 'events.mechanism', value: 'epoll' }
- - { key: 'include', value: '/etc/php/{{ php_version }}/fpm/pool.d/local-pool.cnf' }
- notify:
- - 'Reload FPM for PHP'
- when: with_fpm and ansible_lsb.major_release|int >= 9
- - name: 'Install FPM pools configuration for PHP 5 (Debian <= 8)'
- template:
- src: 'fpm/php5-fpm-pools.conf.j2'
- dest: '/etc/php5/fpm/pool.d/local-pool.cnf'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - 'Reload FPM for PHP 5'
- when: with_fpm and ansible_lsb.major_release|int <= 8
- - name: 'Install FPM pools configuration for PHP {{ php_version }} (Debian > 9)'
- template:
- src: 'fpm/php-fpm-pools.conf.j2'
- dest: '/etc/php/{{ php_version }}/fpm/pool.d/local-pool.cnf'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - 'Reload FPM for PHP'
- when: with_fpm and ansible_lsb.major_release|int >= 9
- - name: 'Install local PHP configuration overrides for php5-fpm (Debian 8)'
- template:
- src: 'php/php-config-web.ini.j2'
- dest: '/etc/php5/fpm/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_fpm and ansible_lsb.major_release|int == 8
- - name: 'Install local PHP configuration overrides for php{{ php_version }}-fpm (Debian >= 9)'
- template:
- src: 'php/php-config-web.ini.j2'
- dest: '/etc/php/{{ php_version }}/fpm/conf.d/99-local-config.ini'
- owner: 'root'
- group: 'root'
- mode: 0644
- when: with_fpm and ansible_lsb.major_release|int >= 9
- - name: 'Install Nginx config files for PHP FPM (fpm servers pool)'
- template:
- src: 'fpm/nginx/fpm-pool.conf.j2'
- dest: '/etc/nginx/conf.d/fpm-pool.conf'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - 'Reload nginx'
- when: with_fpm and with_nginx
- - name: 'Install Nginx config files for PHP FPM (fpm fastcgi config)'
- template:
- src: 'fpm/nginx/fastcgi_pass_fpm.j2'
- dest: '/etc/nginx/fastcgi_pass_fpm'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - 'Reload nginx'
- when: with_fpm and with_nginx
- - name: 'Ensure FPM for PHP 5 is running (Debian <= 8)'
- service:
- name: 'php5-fpm'
- state: 'started'
- when: with_fpm and ansible_lsb.major_release|int <= 8
- - name: 'Ensure FPM for PHP {{ php_version }} is running (Debian >= 9)'
- service:
- name: 'php{{ php_version }}-fpm'
- state: 'started'
- when: with_fpm and ansible_lsb.major_release|int >= 9
- # vim: ft=ansible
|