You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.2 KiB

  1. ---
  2. - name: Install nginx
  3. apt:
  4. name: nginx
  5. - name: Remove nginx from init.d (may conflict with systemd service)
  6. file:
  7. path: /etc/init.d/nginx
  8. state: absent
  9. when: is_docker
  10. - name: Update rc.d to reflect init.d removal
  11. command:
  12. cmd: update-rc.d nginx remove
  13. when: is_docker
  14. - name: Create nginx user
  15. user:
  16. name: nginx
  17. create_home: false
  18. - name: Create nginx.conf file
  19. template:
  20. src: nginx.conf.jinja2
  21. dest: /etc/nginx/nginx.conf
  22. owner: root
  23. group: root
  24. mode: 0644
  25. notify:
  26. - Reload nginx
  27. - name: Create sites-available directory
  28. file:
  29. path: /etc/nginx/sites-available
  30. state: directory
  31. owner: root
  32. group: root
  33. mode: 0755
  34. - name: Create sites-enabled directory
  35. file:
  36. path: /etc/nginx/sites-enabled
  37. state: directory
  38. owner: root
  39. group: root
  40. mode: 0744
  41. - name: Disable nginx default site
  42. file:
  43. path: /etc/nginx/sites-enabled/default
  44. state: absent
  45. notify:
  46. - Reload nginx
  47. - name: Start and enable nginx service
  48. systemd_service:
  49. name: nginx
  50. state: started
  51. enabled: true
  52. - name: Add logrotate config
  53. copy:
  54. src: logrotate
  55. dest: /etc/logrotate.d/nginx
  56. owner: root
  57. group: root
  58. mode: 0644