--- - name: Extract annotations ansible.builtin.shell: >- grep --no-filename --regexp 'PLAY \[' --regexp 'TASK \[kustomize_deploy : Apply generated content for' --regexp 'TASK \[test_operator : Run' $( find "{{ ansible_user_dir }}" -iname 'ansible*.log' 2>/dev/null ) | sed --regexp-extended --expression 's#p=[0-9]+ u=[^ ]+ n=[^ ]+ |##g' --expression 's# (_raw_params|msg|chdir)=.*#]#g' --expression 's#[ *]*$##g' | sort --numeric-sort --key=1,2 | uniq ignore_errors: true changed_when: false register: _annotations_shell - name: Ensure the output directory exist ansible.builtin.file: path: "{{ pcp_metrics_output_dir }}" state: directory mode: '0755' - name: Save annotations ansible.builtin.copy: content: "{{ _annotations_shell.stdout }}" dest: "{{ pcp_metrics_output_dir }}/annotations.txt" mode: "0644"