You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.4 KiB

  1. ---
  2. - name: Install and manage PHP environment
  3. collections: [ 'debops.debops', 'debops.roles01',
  4. 'debops.roles02', 'debops.roles03' ]
  5. hosts: [ 'debian10' ]
  6. become: True
  7. environment: '{{ inventory__environment | d({})
  8. | combine(inventory__group_environment | d({}))
  9. | combine(inventory__host_environment | d({})) }}'
  10. vars:
  11. php__version_preference: [ 'php7.4' ]
  12. php__sury: '{{ ansible_local.php.sury
  13. |d(ansible_distribution_release in [ "buster" ]) | bool }}'
  14. php__sury_apt_key_id: '{{ php__sury_apt_key_id_map[ansible_distribution] }}'
  15. php__sury_apt_repo: '{{ php__sury_apt_repo_map[ansible_distribution] }}'
  16. php__sury_apt_key_id_map:
  17. 'Debian':
  18. - id: '1505 8500 A023 5D97 F5D1 0063 B188 E2B6 95BD 4743'
  19. repo: 'deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main'
  20. state: '{{ "present" if php__sury|bool else "absent" }}'
  21. # Key replaced due to security concerns
  22. # Ref: https://www.patreon.com/posts/dpa-new-signing-25451165
  23. - id: 'DF3D 585D B8F0 EB65 8690 A554 AC0E 4758 4A7A 714D'
  24. state: 'absent'
  25. php__sury_apt_repo_map:
  26. 'Debian': 'deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main'
  27. 'Ubuntu': 'ppa:ondrej/php'
  28. php__base_packages:
  29. - unzip
  30. - git
  31. # mysql - это нужно только для WordPress
  32. # mbstring требует только некоторые пакеты в laravel
  33. # bcmath - нужно для работы парсера Excel файлов на одном из проектов
  34. # Laravel/OctoberCMS: intl, redis
  35. php__packages: [ 'curl', 'xml', 'gd', 'zip', 'mbstring', 'mysql', 'bcmath', 'intl', 'redis' ]
  36. php__composer_upstream_enabled: '{{ True
  37. if (ansible_distribution_release in
  38. [ "buster" ])
  39. else False }}'
  40. php__php_included_packages: '{{ php__common_included_packages
  41. + [ "sysvsem", "sysvshm" ] }}'
  42. php__fpm_pm: static
  43. php__fpm_pm_max_children: 26
  44. php__pools:
  45. - name: backend
  46. user: www-data
  47. group: www-data
  48. php_admin_values:
  49. memory_limit: 256M
  50. post_max_size: 800M
  51. upload_max_filesize: 200M
  52. max_execution_time: 600
  53. pm: static
  54. pm_max_children: 3
  55. pre_tasks:
  56. - name: Apply keyring configuration for php environment
  57. import_role:
  58. name: 'keyring'
  59. vars:
  60. keyring__dependent_apt_keys:
  61. - '{{ php__keyring__dependent_apt_keys }}'
  62. tags: [ 'role::keyring', 'skip::keyring', 'role::php' ]
  63. - name: Prepare php environment
  64. import_role:
  65. name: 'php'
  66. tasks_from: 'main_env'
  67. tags: [ 'role::php', 'role::php:env', 'role::logrotate' ]
  68. roles:
  69. - role: apt_preferences
  70. tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
  71. apt_preferences__dependent_list:
  72. - '{{ php__apt_preferences__dependent_list }}'
  73. - role: cron
  74. tags: [ 'role::cron', 'skip::cron' ]
  75. - role: logrotate
  76. tags: [ 'role::logrotate', 'skip::logrotate' ]
  77. logrotate__dependent_config:
  78. - '{{ php__logrotate__dependent_config }}'
  79. - role: apt_install
  80. - role: php
  81. tags: [ 'role::php', 'skip::php' ]