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.

65 lines
1.7 KiB

  1. ---
  2. - name: Manage and configure the Apache HTTP Server
  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/site.yml
  12. - ./../../vars/php.yml
  13. - ./../../vars/apache.yml
  14. vars:
  15. apache__base_packages:
  16. - 'libapache2-mod-php{{ php_version }}'
  17. apache__default_vhost_name:
  18. - '{{ domain_name }}'
  19. - "{{ (has_www_domain and not www_domain_is_primary) | ternary('www.{{ domain_name }}', omit) }}"
  20. apache__modules:
  21. 'php{{ php_version }}': True
  22. 'rewrite':
  23. enabled: True
  24. apache__allow:
  25. - 0.0.0.0
  26. apache__default_vhost:
  27. name: '{{ apache__default_vhost_name }}'
  28. filename: '000-default'
  29. root: '/var/www/html'
  30. root_directives: |-
  31. RewriteEngine On
  32. RewriteOptions Inherit
  33. RewriteBase /
  34. {% if www_domain_is_primary %}
  35. RewriteCond %{HTTP_HOST} ^([^www].*)$
  36. RewriteRule ^(.*)$ https://www.%1/$1 [L,R=301]
  37. {% else %}
  38. RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  39. RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
  40. {% endif %}
  41. RewriteRule "(^|/)\.(?!well-known\/)" - [F]
  42. apache__vhost_allow_override: 'All'
  43. pre_tasks:
  44. - name: Prepare apache environment
  45. import_role:
  46. name: 'apache'
  47. tasks_from: 'main_env'
  48. tags: [ 'role::apache', 'role::apache:env' ]
  49. roles:
  50. - role: apache
  51. tags: [ 'role::apache', 'skip::apache' ]