vhosts.yml 635 B

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