main.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. - name: Add php repository
  2. become: true
  3. ansible.builtin.apt_repository:
  4. repo: ppa:ondrej/php
  5. - name: Install php packages
  6. become: true
  7. apt:
  8. pkg:
  9. - php{{ app_php_version }}-cli
  10. - php{{ app_php_version }}-fpm
  11. - php{{ app_php_version }}-xml
  12. - php{{ app_php_version }}-imap
  13. - php{{ app_php_version }}-intl
  14. - php{{ app_php_version }}-mbstring
  15. - php{{ app_php_version }}-bcmath
  16. - php{{ app_php_version }}-bz2
  17. - php{{ app_php_version }}-zip
  18. - php{{ app_php_version }}-curl
  19. - php{{ app_php_version }}-gd
  20. - php{{ app_php_version }}-imagick
  21. - php{{ app_php_version }}-pgsql
  22. - php{{ app_php_version }}-mysql
  23. - php{{ app_php_version }}-sqlite3
  24. - php{{ app_php_version }}-redis
  25. - php{{ app_php_version }}-amqp
  26. - name: Creates composer install directory
  27. file:
  28. path: "{{ ansible_env.HOME }}/.local/bin"
  29. state: directory
  30. # https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
  31. - name: Download composer
  32. get_url:
  33. url: https://getcomposer.org/download/latest-stable/composer.phar
  34. dest: "{{ ansible_env.HOME }}/.local/bin/composer"
  35. mode: 0755
  36. - name: Maximum allowed size for uploaded files
  37. ansible.builtin.lineinfile:
  38. path: "/etc/php/{{ app_php_version }}/fpm"
  39. line: "upload_max_filesize = 256M"
  40. regexp: "^upload_max_filesize ="
  41. - name: Maximum size of POST data that will be accept
  42. ansible.builtin.lineinfile:
  43. path: "/etc/php/{{ app_php_version }}/fpm"
  44. line: "post_max_size = 256M"
  45. regexp: "^post_max_size ="
  46. - name: Restart php-fpm
  47. become: true
  48. ansible.builtin.systemd:
  49. state: restarted
  50. daemon_reload: yes
  51. name: "php{{ app_php_version }}-fpm"
  52. - name: Restart nginx
  53. become: true
  54. ansible.builtin.systemd:
  55. state: restarted
  56. daemon_reload: yes
  57. name: nginx