apache2.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. - name: 'Install Apache2 packages'
  2. apt:
  3. pkg: 'apache2'
  4. state: 'installed'
  5. update_cache: 'yes'
  6. when: with_apache2
  7. - name: 'Install logrotate configuration for Apache'
  8. template:
  9. src: 'logrotate/apache2.j2'
  10. dest: '/etc/logrotate.d/apache2'
  11. owner: 'root'
  12. group: 'root'
  13. mode: '0644'
  14. when: with_apache2
  15. - name: 'Install SSL vhost configuration for Apache'
  16. template:
  17. src: 'apache2/vhost_ssl.j2'
  18. dest: '/etc/apache2/vhost_ssl-{{ item }}.conf'
  19. owner: 'root'
  20. group: 'root'
  21. mode: '0644'
  22. with_items: ssl_certs
  23. notify:
  24. - 'Reload apache2'
  25. when: with_apache2 and ssl_certs
  26. - name: 'Install Apache2 basic security configuration (Debian < 8)'
  27. template:
  28. src: 'apache2/conf.d/security.j2'
  29. dest: '/etc/apache2/conf.d/security'
  30. owner: 'root'
  31. group: 'root'
  32. mode: '0644'
  33. notify:
  34. - 'Reload apache2'
  35. when: with_apache2 and ansible_lsb.major_release|int < 8
  36. - name: 'Install Apache2 basic security configuration (Debian >= 8)'
  37. template:
  38. src: 'apache2/conf.d/security.j2'
  39. dest: '/etc/apache2/conf-available/security.conf'
  40. owner: 'root'
  41. group: 'root'
  42. mode: '0644'
  43. notify:
  44. - 'Reload apache2'
  45. when: with_apache2 and ansible_lsb.major_release|int >= 8
  46. - name: 'Create basic authentication file for admin (Apache2)'
  47. template:
  48. src: 'apache2/auth_admin.j2'
  49. dest: '/etc/apache2/auth_admin'
  50. owner: 'root'
  51. group: 'www-data'
  52. mode: '0640'
  53. when: with_apache2
  54. - name: 'Install PHPMyAdmin virtual host for Apache2 (sites-available)'
  55. template:
  56. src: 'apache2/pma_vhost.j2'
  57. dest: '/etc/apache2/sites-available/pma.conf'
  58. owner: 'root'
  59. group: 'root'
  60. mode: '0644'
  61. notify:
  62. - 'Reload apache2'
  63. when: with_phpmyadmin and with_apache2
  64. - name: 'Install PHPMyAdmin virtual host for Apache2 (sites-enabled)'
  65. file:
  66. src: '/etc/apache2/sites-available/pma.conf'
  67. path: '/etc/apache2/sites-enabled/pma.conf'
  68. state: 'link'
  69. notify:
  70. - 'Reload apache2'
  71. when: with_phpmyadmin and with_apache2
  72. - name: "Install PHPPgAdmin virtual host for Apache2 (sites-available)"
  73. template:
  74. src: 'apache2/pga_vhost.j2'
  75. dest: '/etc/apache2/sites-available/pga.conf'
  76. owner: 'root'
  77. group: 'root'
  78. mode: '0644'
  79. notify:
  80. - 'Reload apache2'
  81. when: with_phppgadmin and with_apache2
  82. - name: 'Install PHPPgAdmin virtual host for Apache2 (sites-enabled)'
  83. file:
  84. src: '/etc/apache2/sites-available/pga.conf'
  85. path: '/etc/apache2/sites-enabled/pga.conf'
  86. state: 'link'
  87. notify:
  88. - 'Reload apache2'
  89. when: with_phppgadmin and with_apache2
  90. - name: 'Install PHP system checks virtual host for Apache2 (sites-available)'
  91. template:
  92. src: 'apache2/sys_vhost.j2'
  93. dest: '/etc/apache2/sites-available/sys.conf'
  94. owner: 'root'
  95. group: 'root'
  96. mode: '0644'
  97. notify:
  98. - 'Reload apache2'
  99. when: with_php and with_apache2
  100. - name: 'Install PHP system checks virtual host for Apache2 (sites-enabled)'
  101. file:
  102. src: '/etc/apache2/sites-available/sys.conf'
  103. path: '/etc/apache2/sites-enabled/sys.conf'
  104. state: 'link'
  105. notify:
  106. - 'Reload apache2'
  107. when: with_php and with_apache2
  108. - name: 'Ensure apache2 is running'
  109. service:
  110. name: 'apache2'
  111. state: 'started'
  112. when: with_apache2