main.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. become: true
  38. ansible.builtin.lineinfile:
  39. path: "/etc/php/{{ app_php_version }}/fpm/php.ini"
  40. line: "upload_max_filesize = 256M"
  41. regexp: "^upload_max_filesize ="
  42. - name: Maximum size of POST data that will be accept
  43. become: true
  44. ansible.builtin.lineinfile:
  45. path: "/etc/php/{{ app_php_version }}/fpm/php.ini"
  46. line: "post_max_size = 256M"
  47. regexp: "^post_max_size ="
  48. - name: Restart php-fpm
  49. become: true
  50. ansible.builtin.systemd:
  51. state: restarted
  52. daemon_reload: yes
  53. name: "php{{ app_php_version }}-fpm"
  54. - name: Restart nginx
  55. become: true
  56. ansible.builtin.systemd:
  57. state: restarted
  58. daemon_reload: yes
  59. name: nginx