nginx.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. - name: Install nginx package
  2. apt: pkg=nginx state=installed update_cache=yes
  3. when: with_nginx
  4. - name: Install nginx default file configuration
  5. template: src=nginx/default.j2 dest=/etc/default/nginx owner=root group=root mode=0644
  6. notify:
  7. - Restart nginx
  8. when: with_nginx
  9. - name: Install nginx configuration
  10. template: src=nginx/nginx.conf.j2 dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
  11. notify:
  12. - Restart nginx
  13. when: with_nginx
  14. - name: Install additional nginx configuration params (conf.d/)
  15. template: src=nginx/conf.d/{{ item }}.conf.j2 dest=/etc/nginx/conf.d/{{ item }}.conf owner=root group=root mode=0644
  16. with_items:
  17. - status
  18. notify:
  19. - Reload nginx
  20. when: with_nginx
  21. - name: Install additional nginx configuration params (vhost_*)
  22. template: src=nginx/vhost_{{ item }}.j2 dest=/etc/nginx/vhost_{{ item }} owner=root group=root mode=0644
  23. with_items:
  24. - all
  25. - expires
  26. - cache-fd
  27. - protect-files
  28. notify:
  29. - Reload nginx
  30. when: with_nginx
  31. - name: Create basic authentication file for admin (nginx)
  32. template: src=nginx/auth_admin.j2 dest=/etc/nginx/auth_admin owner=root group=www-data mode=0640
  33. when: with_nginx
  34. - name: Install PHPMyAdmin virtual host for nginx (sites-available)
  35. template: src=nginx/pma_vhost.j2 dest=/etc/nginx/sites-available/pma owner=root group=root mode=0644
  36. notify:
  37. - Reload nginx
  38. when: with_phpmyadmin and with_nginx
  39. - name: Install PHPMyAdmin virtual host for nginx (sites-enabled)
  40. file: src=/etc/nginx/sites-available/pma path=/etc/nginx/sites-enabled/pma state=link
  41. notify:
  42. - Reload nginx
  43. when: with_phpmyadmin and with_nginx
  44. - name: Install PHP system checks virtual host for nginx (sites-available)
  45. template: src=nginx/sys_vhost.j2 dest=/etc/nginx/sites-available/sys owner=root group=root mode=0644
  46. notify:
  47. - Reload nginx
  48. when: with_php and with_nginx
  49. - name: Install PHP system checks virtual host for nginx (sites-enabled)
  50. file: src=/etc/nginx/sites-available/sys path=/etc/nginx/sites-enabled/sys state=link
  51. notify:
  52. - Reload nginx
  53. when: with_php and with_nginx
  54. - name: Ensure nginx is running
  55. service: name=nginx state=started
  56. when: with_nginx