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.

80 lines
3.0 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. php__packages: [ 'curl', 'xml', 'gd', 'zip', 'mbstring', 'mysql', 'bcmath' ]
  35. php__composer_upstream_enabled: '{{ True
  36. if (ansible_distribution_release in
  37. [ "buster" ])
  38. else False }}'
  39. php__php_included_packages: '{{ php__common_included_packages
  40. + [ "sysvsem", "sysvshm" ] }}'
  41. pre_tasks:
  42. - name: Apply keyring configuration for php environment
  43. import_role:
  44. name: 'keyring'
  45. vars:
  46. keyring__dependent_apt_keys:
  47. - '{{ php__keyring__dependent_apt_keys }}'
  48. tags: [ 'role::keyring', 'skip::keyring', 'role::php' ]
  49. - name: Prepare php environment
  50. import_role:
  51. name: 'php'
  52. tasks_from: 'main_env'
  53. tags: [ 'role::php', 'role::php:env', 'role::logrotate' ]
  54. roles:
  55. - role: apt_preferences
  56. tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
  57. apt_preferences__dependent_list:
  58. - '{{ php__apt_preferences__dependent_list }}'
  59. - role: cron
  60. tags: [ 'role::cron', 'skip::cron' ]
  61. - role: logrotate
  62. tags: [ 'role::logrotate', 'skip::logrotate' ]
  63. logrotate__dependent_config:
  64. - '{{ php__logrotate__dependent_config }}'
  65. - role: apt_install
  66. - role: php
  67. tags: [ 'role::php', 'skip::php' ]