- name: Install common PHP dependencies apt: pkg={{ item }} state=installed update_cache=yes with_items: - php5-cli - php5-curl - php5-gd - php5-intl - php5-mcrypt - php-mime-type when: with_php - name: Create PHP log directory file: path=/var/log/php state=directory owner=root group=root mode=0755 when: with_php and 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_php and with_fpm - name: Install local PHP configuration template: src=php/php-config.ini.j2 dest=/etc/php5/conf.d/99-local-config.ini owner=root group=root mode=0644 when: with_php - name: Create system checks directory /etc/php5/syscheck.d file: path=/etc/php5/syscheck.d owner=root group=root mode=0755 state=directory when: with_php - name: Install phpinfo system check template: src=php/phpinfo.php dest=/etc/php5/syscheck.d/index.php owner=root group=root mode=0644 when: with_php - name: Install PHP APC extension apt: pkg=php-apc state=installed update_cache=yes when: with_php_apc - name: Install php-apc system check template: src=php/apc.php dest=/etc/php5/syscheck.d/apc.php owner=root group=root mode=0644 when: with_php_apc - name: Install MySQL extension for PHP (native driver) apt: pkg=php5-mysqlnd state=installed update_cache=yes when: with_php and not with_php_lt_54 - name: Install MySQL extension for PHP (old driver) apt: pkg=php5-mysql state=installed update_cache=yes when: with_php and with_php_lt_54 - name: Install PHPMyAdmin apt: pkg=phpmyadmin state=installed update_cache=yes when: with_phpmyadmin - name: Install php5-fpm package apt: pkg=php5-fpm state=installed update_cache=yes when: with_fpm - name: Install php5-fpm init script config file template: src=fpm/default.j2 dest=/etc/default/php5-fpm owner=root group=root mode=0644 notify: - Restart php5-fpm when: with_fpm - name: Install php5-fpm configuration file template: src=fpm/php-fpm-custom.conf.j2 dest=/etc/php5/fpm/php-fpm-custom.conf owner=root group=root mode=0644 notify: - Restart php5-fpm when: with_fpm - name: Install nginx config files for php5-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 php5-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 php5-fpm is running service: name=php5-fpm state=started when: with_fpm