nginx.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. - security
  29. notify:
  30. - Reload nginx
  31. when: with_nginx
  32. - name: Create basic authentication file for admin (nginx)
  33. template: src=nginx/auth_admin.j2 dest=/etc/nginx/auth_admin owner=root group=www-data mode=0640
  34. when: with_nginx
  35. - name: Install PHPMyAdmin virtual host for nginx (sites-available)
  36. template: src=nginx/pma_vhost.j2 dest=/etc/nginx/sites-available/pma owner=root group=root mode=0644
  37. notify:
  38. - Reload nginx
  39. when: with_phpmyadmin and with_nginx
  40. - name: Install PHPMyAdmin virtual host for nginx (sites-enabled)
  41. file: src=/etc/nginx/sites-available/pma path=/etc/nginx/sites-enabled/pma state=link
  42. notify:
  43. - Reload nginx
  44. when: with_phpmyadmin and with_nginx
  45. - name: Install PHPPgAdmin virtual host for nginx (sites-available)
  46. template: src=nginx/pga_vhost.j2 dest=/etc/nginx/sites-available/pga owner=root group=root mode=0644
  47. notify:
  48. - Reload nginx
  49. when: with_phppgadmin and with_nginx
  50. - name: Install PHPPgAdmin virtual host for nginx (sites-enabled)
  51. file: src=/etc/nginx/sites-available/pga path=/etc/nginx/sites-enabled/pga state=link
  52. notify:
  53. - Reload nginx
  54. when: with_phppgadmin and with_nginx
  55. - name: Install PHP system checks virtual host for nginx (sites-available)
  56. template: src=nginx/sys_vhost.j2 dest=/etc/nginx/sites-available/sys owner=root group=root mode=0644
  57. notify:
  58. - Reload nginx
  59. when: with_php and with_nginx
  60. - name: Install PHP system checks virtual host for nginx (sites-enabled)
  61. file: src=/etc/nginx/sites-available/sys path=/etc/nginx/sites-enabled/sys state=link
  62. notify:
  63. - Reload nginx
  64. when: with_php and with_nginx
  65. - name: Ensure nginx is running
  66. service: name=nginx state=started
  67. when: with_nginx