---
- name: gather facts used by role
  setup:
    gather_subset: "!min,pkg_mgr"
  when: ansible_pkg_mgr is not defined

- name: Collect logs
  include: collect.yml
  when: artcl_collect|bool

- name: Generate docs
  include: create-docs.yml
  when:
    - artcl_gen_docs|bool
    - not artcl_collect|bool

- name: Publish logs
  include: publish.yml
  when:
    - artcl_publish|bool
    - not artcl_collect|bool

- name: Verify Sphinx build
  shell:
    grep -q "{{ item }}" "{{ artcl_collect_dir }}/docs/build/index.html"
  with_items: "{{ artcl_create_docs_payload.table_of_contents }}"
  changed_when: false
  when:
    - artcl_gen_docs|bool
    - artcl_verify_sphinx_build|bool
    - not artcl_collect|bool
