--- # Controller-side analysis. Runs on localhost over the artifact directory, so it is # independent of whether any surveyed node is still alive — and so it can be re-run on # its own (`--tags analyse`) without touching hardware. # # The statistics live in files/memattr_analyse.py, not in Jinja: Clopper-Pearson and # Fisher belong somewhere testable, and a confidence interval assembled out of template # filters is a confidence interval nobody will ever check. - name: Locate the survey artifacts ansible.builtin.find: paths: "{{ memattr_survey_artifact_dir }}" patterns: "*.boots.json" register: memattr_survey_artifacts - name: Report that there is nothing to analyse ansible.builtin.debug: msg: >- No *.boots.json under {{ memattr_survey_artifact_dir }} — no survey has produced a harvest yet. Run the playbook with -e memattr_survey_reboots_authorised=true. when: memattr_survey_artifacts.matched | int == 0 - name: Analyse the survey ansible.builtin.command: argv: - /usr/bin/env - python3 - "{{ role_path }}/files/memattr_analyse.py" - "--artifact-dir" - "{{ memattr_survey_artifact_dir }}" - "--rounds" - "{{ memattr_survey_rounds }}" - "--out" - "{{ memattr_survey_artifact_dir }}/summary.md" register: memattr_survey_analysis changed_when: false when: memattr_survey_artifacts.matched | int > 0 - name: Show the analysis ansible.builtin.debug: msg: "{{ memattr_survey_analysis.stdout.split('\n') }}" when: memattr_survey_analysis is not skipped