nginx.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. - name: Install nginx package
  2. action: ${ansible_pkg_mgr} pkg=nginx state=installed update_cache=yes
  3. when_boolean: ${with_nginx}
  4. - name: Install nginx default file configuration
  5. action: template src=nginx/default.j2 dest=/etc/default/nginx owner=root group=root mode=0644
  6. notify:
  7. - Restart nginx
  8. when_boolean: ${with_nginx}
  9. - name: Install nginx configuration
  10. action: template src=nginx/nginx.conf.j2 dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
  11. notify:
  12. - Restart nginx
  13. when_boolean: ${with_nginx}
  14. - name: Install additional nginx configuration params (conf.d/)
  15. action: 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_boolean: ${with_nginx}
  21. - name: Install additional nginx configuration params (vhost_*)
  22. action: 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_boolean: ${with_nginx}
  31. - name: Create basic authentication file for admin (nginx)
  32. action: template src=nginx/auth_admin.j2 dest=/etc/nginx/auth_admin owner=root group=www-data mode=0640
  33. when_boolean: ${with_nginx}
  34. - name: Install PHPMyAdmin virtual host for nginx (sites-available)
  35. action: 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_boolean: ${with_phpmyadmin} and ${with_nginx}
  39. - name: Install PHPMyAdmin virtual host for nginx (sites-enabled)
  40. action: file src=/etc/nginx/sites-available/pma path=/etc/nginx/sites-enabled/pma state=link
  41. notify:
  42. - Reload nginx
  43. when_boolean: ${with_phpmyadmin} and ${with_nginx}
  44. - name: Install PHP system checks virtual host for nginx (sites-available)
  45. action: 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_boolean: ${with_php} and ${with_nginx}
  49. - name: Install PHP system checks virtual host for nginx (sites-enabled)
  50. action: file src=/etc/nginx/sites-available/sys path=/etc/nginx/sites-enabled/sys state=link
  51. notify:
  52. - Reload nginx
  53. when_boolean: ${with_php} and ${with_nginx}
  54. - name: Ensure nginx is running
  55. action: service name=nginx state=started
  56. when_boolean: ${with_nginx}