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.

82 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_files:
  11. - ./../../vars/php.yml
  12. vars:
  13. php__sury: '{{ ansible_local.php.sury
  14. |d(ansible_distribution_release in [ "buster" ]) | bool }}'
  15. php__sury_apt_key_id: '{{ php__sury_apt_key_id_map[ansible_distribution] }}'
  16. php__sury_apt_repo: '{{ php__sury_apt_repo_map[ansible_distribution] }}'
  17. php__sury_apt_key_id_map:
  18. 'Debian':
  19. - id: '1505 8500 A023 5D97 F5D1 0063 B188 E2B6 95BD 4743'
  20. repo: 'deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main'
  21. state: '{{ "present" if php__sury|bool else "absent" }}'
  22. # Key replaced due to security concerns
  23. # Ref: https://www.patreon.com/posts/dpa-new-signing-25451165
  24. - id: 'DF3D 585D B8F0 EB65 8690 A554 AC0E 4758 4A7A 714D'
  25. state: 'absent'
  26. php__sury_apt_repo_map:
  27. 'Debian': 'deb https://packages.sury.org/php/ {{ ansible_distribution_release }} main'
  28. 'Ubuntu': 'ppa:ondrej/php'
  29. php__base_packages:
  30. - unzip
  31. - git
  32. # mysql - это нужно только для WordPress
  33. # mbstring требует только некоторые пакеты в laravel
  34. # bcmath - нужно для работы парсера Excel файлов на одном из проектов
  35. php__packages: [ 'curl', 'xml', 'gd', 'zip', 'mbstring', 'mysql', 'bcmath' ]
  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. pre_tasks:
  43. - name: Apply keyring configuration for php environment
  44. import_role:
  45. name: 'keyring'
  46. vars:
  47. keyring__dependent_apt_keys:
  48. - '{{ php__keyring__dependent_apt_keys }}'
  49. tags: [ 'role::keyring', 'skip::keyring', 'role::php' ]
  50. - name: Prepare php environment
  51. import_role:
  52. name: 'php'
  53. tasks_from: 'main_env'
  54. tags: [ 'role::php', 'role::php:env', 'role::logrotate' ]
  55. roles:
  56. - role: apt_preferences
  57. tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
  58. apt_preferences__dependent_list:
  59. - '{{ php__apt_preferences__dependent_list }}'
  60. - role: cron
  61. tags: [ 'role::cron', 'skip::cron' ]
  62. - role: logrotate
  63. tags: [ 'role::logrotate', 'skip::logrotate' ]
  64. logrotate__dependent_config:
  65. - '{{ php__logrotate__dependent_config }}'
  66. - role: apt_install
  67. - role: php
  68. tags: [ 'role::php', 'skip::php' ]