ansible-role-collect-logs/roles/collect_logs/tasks/create-docs.yml

46 lines
1.5 KiB
YAML

---
- name: Ensure required python packages are installed
pip:
requirements: "{{ local_working_dir }}/share/ansible/roles/collect-logs/docs/doc-requirements.txt"
executable: "{{ local_working_dir }}/bin/pip"
- name: Generate rST docs from scripts and move to Sphinx src dir
shell: >
awk -f "{{ local_working_dir }}/share/ansible/roles/collect-logs/scripts/doc_extrapolation.awk" \
"{{ artcl_collect_dir }}/undercloud/home/{{ undercloud_user }}/{{ item }}.sh" > \
"{{ artcl_docs_source_dir }}/{{ item }}.rst"
with_items: "{{ artcl_create_docs_payload.included_deployment_scripts }}"
ignore_errors: true # noqa: ignore-errors
changed_when: true
- name: Fetch static rST docs to include in output docs
shell: >
cp "{{ artcl_docs_source_dir }}/../static/{{ item }}.rst" "{{ artcl_docs_source_dir }}"
with_items: "{{ artcl_create_docs_payload.included_static_docs }}"
ignore_errors: true # noqa: ignore-errors
changed_when: true
- name: Generate fresh index.rst for Sphinx
template:
src: index.rst.j2
dest: "{{ artcl_docs_source_dir }}/index.rst"
force: true
mode: 0644
- name: Ensure docs dir exists
file:
path: "{{ artcl_collect_dir }}/docs"
state: directory
mode: 0755
- name: Build docs with Sphinx
shell: >
set -o pipefail &&
sphinx-build -b html "{{ artcl_docs_source_dir }}" "{{ artcl_docs_build_dir }}"
2>&1 {{ timestamper_cmd }} > {{ artcl_collect_dir }}/docs/sphinx_build.log
args:
executable: /bin/bash
ignore_errors: true # noqa: ignore-errors
changed_when: true