vhosts.yml 619 B

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