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