vhosts.yml 777 B

12345678910111213141516171819202122232425262728
  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: restart nginx
  8. - name: Ensure nginx_vhost_path exists.
  9. file:
  10. path: "{{ nginx_vhost_path }}"
  11. state: directory
  12. notify: reload nginx
  13. - name: Add managed vhost config file (if any vhosts are configured).
  14. template:
  15. src: vhosts.j2
  16. dest: "{{ nginx_vhost_path }}/{{ nginx_vhosts_filename }}"
  17. mode: 0644
  18. when: nginx_vhosts|length > 0
  19. notify: reload nginx
  20. - name: Remove managed vhost config file (if no vhosts are configured).
  21. file:
  22. path: "{{ nginx_vhost_path }}/{{ nginx_vhosts_filename }}"
  23. state: absent
  24. when: nginx_vhosts|length == 0
  25. notify: reload nginx