php.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. - name: Install common PHP dependencies
  2. apt: pkg={{ item }} state=installed update_cache=yes
  3. with_items:
  4. - php5-cli
  5. - php5-curl
  6. - php5-gd
  7. - php5-intl
  8. - php5-mcrypt
  9. - php-mime-type
  10. when: with_php
  11. - name: Create PHP log directory
  12. file: path=/var/log/php state=directory owner=root group=root mode=0755
  13. when: with_php and with_fpm
  14. - name: Install PHP configuration for syslog
  15. template: src={{ item.src }} dest={{ item.dest }} owner=root group=root mode=0644
  16. with_items:
  17. - { src: 'rsyslog/php-errors.conf.j2', dest: '/etc/rsyslog.d/php-errors.conf' }
  18. - { src: 'logrotate/php-errors.j2', dest: '/etc/logrotate.d/php-errors' }
  19. notify:
  20. - Reload rsyslog for php
  21. when: with_php and with_fpm
  22. - name: Install local PHP configuration
  23. template: src=php/php-config.ini.j2 dest=/etc/php5/conf.d/99-local-config.ini owner=root group=root mode=0644
  24. when: with_php
  25. - name: Create system checks directory /etc/php5/syscheck.d
  26. file: path=/etc/php5/syscheck.d owner=root group=root mode=0755 state=directory
  27. when: with_php
  28. - name: Install phpinfo system check
  29. template: src=php/phpinfo.php dest=/etc/php5/syscheck.d/index.php owner=root group=root mode=0644
  30. when: with_php
  31. - name: Install PHP APC extension
  32. apt: pkg=php-apc state=installed update_cache=yes
  33. when: with_php_apc
  34. - name: Install php-apc system check
  35. template: src=php/apc.php dest=/etc/php5/syscheck.d/apc.php owner=root group=root mode=0644
  36. when: with_php_apc
  37. - name: Install MySQL extension for PHP (native driver)
  38. apt: pkg=php5-mysqlnd state=installed update_cache=yes
  39. when: with_php and not with_php_lt_54
  40. - name: Install MySQL extension for PHP (old driver)
  41. apt: pkg=php5-mysql state=installed update_cache=yes
  42. when: with_php and with_php_lt_54
  43. - name: Install PHPMyAdmin
  44. apt: pkg=phpmyadmin state=installed update_cache=yes
  45. when: with_phpmyadmin
  46. - name: Install php5-fpm package
  47. apt: pkg=php5-fpm state=installed update_cache=yes
  48. when: with_fpm
  49. - name: Install php5-fpm init script config file
  50. template: src=fpm/default.j2 dest=/etc/default/php5-fpm owner=root group=root mode=0644
  51. notify:
  52. - Restart php5-fpm
  53. when: with_fpm
  54. - name: Install php5-fpm configuration file
  55. template: src=fpm/php-fpm-custom.conf.j2 dest=/etc/php5/fpm/php-fpm-custom.conf owner=root group=root mode=0644
  56. notify:
  57. - Restart php5-fpm
  58. when: with_fpm
  59. - name: Install nginx config files for php5-fpm (fpm servers pool)
  60. template: src=fpm/nginx/fpm-pool.conf.j2 dest=/etc/nginx/conf.d/fpm-pool.conf owner=root group=root mode=0644
  61. notify:
  62. - Reload nginx
  63. when: with_fpm and with_nginx
  64. - name: Install nginx config files for php5-fpm (fpm fastcgi config)
  65. template: src=fpm/nginx/fastcgi_pass_fpm.j2 dest=/etc/nginx/fastcgi_pass_fpm owner=root group=root mode=0644
  66. notify:
  67. - Reload nginx
  68. when: with_fpm and with_nginx
  69. - name: Ensure php5-fpm is running
  70. service: name=php5-fpm state=started
  71. when: with_fpm