nginx.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. - name: ensure nginx is installed
  3. apt:
  4. name: nginx-extras
  5. state: latest
  6. default_release: "{{ ansible_distribution_release }}-backports"
  7. install_recommends: no
  8. update_cache: yes
  9. cache_valid_time: 86400
  10. - name: ensure nginx default configuration is disabled
  11. file: name=/etc/nginx/sites-enabled/default state=absent
  12. notify: Reload nginx
  13. - name: ensure nginx ssl parameters are installed
  14. copy: src=ssl.conf dest=/etc/nginx/ssl.conf
  15. notify: Reload nginx
  16. - name: Ensure unsecure default configuration is up to date
  17. template:
  18. src: nginx_unsecure_default.conf.j2
  19. dest: /etc/nginx/sites-available/unsecure_default.conf
  20. notify: Reload nginx
  21. - name: Ensure unsecure default configuration is enabled
  22. file:
  23. state: link
  24. dest: /etc/nginx/sites-enabled/unsecure_default.conf
  25. src: /etc/nginx/sites-available/unsecure_default.conf
  26. notify: Reload nginx
  27. - name: Ensure site include directory exists
  28. file:
  29. state: directory
  30. dest: "/etc/nginx/site-include/{{ ansible_fqdn }}"