apache2.yml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. - name: Install apache2 packages
  2. apt: pkg=apache2 state=installed update_cache=yes
  3. when: with_apache2
  4. - name: Install apache2 basic security configuration (Debian < 8)
  5. template: src=apache2/conf.d/security.j2 dest=/etc/apache2/conf.d/security owner=root group=root mode=0644
  6. notify:
  7. - Reload apache2
  8. when: with_apache2 and ansible_lsb.major_release|int < 8
  9. - name: Install apache2 basic security configuration (Debian >= 8)
  10. template: src=apache2/conf.d/security.j2 dest=/etc/apache2/conf-available/security.conf owner=root group=root mode=0644
  11. notify:
  12. - Reload apache2
  13. when: with_apache2 and ansible_lsb.major_release|int >= 8
  14. - name: Create basic authentication file for admin (apache2)
  15. template: src=apache2/auth_admin.j2 dest=/etc/apache2/auth_admin owner=root group=www-data mode=0640
  16. when: with_apache2
  17. - name: Install PHPMyAdmin virtual host for apache2 (sites-available)
  18. template: src=apache2/pma_vhost.j2 dest=/etc/apache2/sites-available/pma.conf owner=root group=root mode=0644
  19. notify:
  20. - Reload apache2
  21. when: with_phpmyadmin and with_apache2
  22. - name: Install PHPMyAdmin virtual host for apache2 (sites-enabled)
  23. file: src=/etc/apache2/sites-available/pma.conf path=/etc/apache2/sites-enabled/pma.conf state=link
  24. notify:
  25. - Reload apache2
  26. when: with_phpmyadmin and with_apache2
  27. - name: Install PHPPgAdmin virtual host for apache2 (sites-available)
  28. template: src=apache2/pga_vhost.j2 dest=/etc/apache2/sites-available/pga.conf owner=root group=root mode=0644
  29. notify:
  30. - Reload apache2
  31. when: with_phppgadmin and with_apache2
  32. - name: Install PHPPgAdmin virtual host for apache2 (sites-enabled)
  33. file: src=/etc/apache2/sites-available/pga.conf path=/etc/apache2/sites-enabled/pga.conf state=link
  34. notify:
  35. - Reload apache2
  36. when: with_phppgadmin and with_apache2
  37. - name: Install PHP system checks virtual host for apache2 (sites-available)
  38. template: src=apache2/sys_vhost.j2 dest=/etc/apache2/sites-available/sys.conf owner=root group=root mode=0644
  39. notify:
  40. - Reload apache2
  41. when: with_php and with_apache2
  42. - name: Install PHP system checks virtual host for apache2 (sites-enabled)
  43. file: src=/etc/apache2/sites-available/sys.conf path=/etc/apache2/sites-enabled/sys.conf state=link
  44. notify:
  45. - Reload apache2
  46. when: with_php and with_apache2
  47. - name: Ensure apache2 is running
  48. service: name=apache2 state=started
  49. when: with_apache2