Good evening.
There was such a pickling question, have not yet met an adequate solution.
How to calculate the elapsed time to lose a playbook for each host is required to compile a reporting message in Telegrams.
While this is such a stub, it does not always show the correct time if the playbook is made in parallel for several hosts:
pl-signoff.yml
#!/usr/bin/ansible-playbook - hosts: _signoff gather_facts: false vars: - playbook_name: "pl-signoff" - build_version: 1.41 pre_tasks: - local_action: shell date register: pl_begin become: false roles: - role-1 - role-2 # etc - inspector roles / inspector / tasks / main.yml
- name: "last probe of facts" setup: - local_action: shell date register: pl_end become: false - name: "shout it loud to signoff_test" telegram: msg_format: plain token: 'my_tocken' chat_id: my_id msg: | BEGIN: "{{ pl_begin }}" PL: "{{ playbook_name }}" MSG: task complete for the site "{{ site-id }}" END: "{{ pl_end }}"