vhosts.yml 743 B

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