vhosts.yml 772 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Remove default nginx vhost config file (if configured).
  3. file:
  4. path: "{{ nginx_default_vhost_path }}"
  5. state: absent
  6. when: nginx_remove_default_vhost
  7. notify:
  8. - reload nginx
  9. - name: Create nginx_vhost_path directory.
  10. file:
  11. path: "{{ nginx_vhost_path }}"
  12. state: directory
  13. notify:
  14. - reload nginx
  15. - name: Add managed vhost config file (if any vhosts are configured).
  16. template:
  17. src: vhosts.j2
  18. dest: "{{ nginx_vhost_path }}/vhosts.conf"
  19. mode: 0644
  20. when: nginx_vhosts|length > 0
  21. notify:
  22. - reload nginx
  23. - name: Remove managed vhost config file (if no vhosts are configured).
  24. file:
  25. path: "{{ nginx_vhost_path }}/vhosts.conf"
  26. state: absent
  27. when: nginx_vhosts|length == 0
  28. notify:
  29. - reload nginx