apache2.yml 3.0 KB

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