apache2.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 PHP system checks virtual host for apache2 (sites-available)
  28. template: src=apache2/sys_vhost.j2 dest=/etc/apache2/sites-available/sys.conf owner=root group=root mode=0644
  29. notify:
  30. - Reload apache2
  31. when: with_php and with_apache2
  32. - name: Install PHP system checks virtual host for apache2 (sites-enabled)
  33. file: src=/etc/apache2/sites-available/sys.conf path=/etc/apache2/sites-enabled/sys.conf state=link
  34. notify:
  35. - Reload apache2
  36. when: with_php and with_apache2
  37. - name: Ensure apache2 is running
  38. service: name=apache2 state=started
  39. when: with_apache2