
    Vh                        d dl mZ dZdZd dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ d d	lmZ 	 d d
lmZ dZ G d de      Z G d de      Zy# e$ r dZY  w xY w)    )annotationsuL  
name: diy
type: stdout
short_description: Customize the output
version_added: 0.2.0
description:
  - Callback plugin that allows you to supply your own custom callback templates to be output.
author: Trevor Highfill (@theque5t)
extends_documentation_fragment:
  - default_callback
notes:
  - Uses the P(ansible.builtin.default#callback) callback plugin output when a custom callback V(message(msg\)) is not provided.
  - Makes the callback event data available using the C(ansible_callback_diy) dictionary, which can be used in the templating
    context for the options. The dictionary is only available in the templating context for the options. It is not a variable
    that is available using the other various execution contexts, such as playbook, play, task, and so on so forth.
  - Options being set by their respective variable input can only be set using the variable if the variable was set in a context
    that is available to the respective callback. Use the C(ansible_callback_diy) dictionary to see what is available to a
    callback. Additionally, C(ansible_callback_diy.top_level_var_names) will output the top level variable names available
    to the callback.
  - Each option value is rendered as a template before being evaluated. This allows for the dynamic usage of an option. For
    example, C("{{ 'yellow' if ansible_callback_diy.result.is_changed else 'bright green' }}").
  - 'B(Condition) for all C(msg) options: if value C(is None or omit), then the option is not being used. B(Effect): use
    of the C(default) callback plugin for output.'
  - 'B(Condition) for all C(msg) options: if value C(is not None and not omit and length is not greater than 0), then the
    option is being used without output. B(Effect): suppress output.'
  - 'B(Condition) for all C(msg) options: if value C(is not None and not omit and length is greater than 0), then the option
    is being used with output. B(Effect): render value as template and output.'
  - 'Valid color values: V(black), V(bright gray), V(blue), V(white), V(green), V(bright blue), V(cyan), V(bright green),
    V(red), V(bright cyan), V(purple), V(bright red), V(yellow), V(bright purple), V(dark gray), V(bright yellow), V(magenta),
    V(bright magenta), V(normal).'
seealso:
  - name: default – default Ansible screen output
    description: The official documentation on the B(default) callback plugin.
    link: https://docs.ansible.com/ansible/latest/plugins/callback/default.html
requirements:
  - set as stdout_callback in configuration
options:
  on_any_msg:
    description: Output to be used for callback on_any.
    ini:
      - section: callback_diy
        key: on_any_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_ON_ANY_MSG
    vars:
      - name: ansible_callback_diy_on_any_msg
    type: str

  on_any_msg_color:
    description:
      - Output color to be used for O(on_any_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: on_any_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_ON_ANY_MSG_COLOR
    vars:
      - name: ansible_callback_diy_on_any_msg_color
    type: str

  runner_on_failed_msg:
    description: Output to be used for callback runner_on_failed.
    ini:
      - section: callback_diy
        key: runner_on_failed_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_FAILED_MSG
    vars:
      - name: ansible_callback_diy_runner_on_failed_msg
    type: str

  runner_on_failed_msg_color:
    description:
      - Output color to be used for O(runner_on_failed_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_failed_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_FAILED_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_failed_msg_color
    type: str

  runner_on_ok_msg:
    description: Output to be used for callback runner_on_ok.
    ini:
      - section: callback_diy
        key: runner_on_ok_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_OK_MSG
    vars:
      - name: ansible_callback_diy_runner_on_ok_msg
    type: str

  runner_on_ok_msg_color:
    description:
      - Output color to be used for O(runner_on_ok_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_ok_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_OK_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_ok_msg_color
    type: str

  runner_on_skipped_msg:
    description: Output to be used for callback runner_on_skipped.
    ini:
      - section: callback_diy
        key: runner_on_skipped_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_SKIPPED_MSG
    vars:
      - name: ansible_callback_diy_runner_on_skipped_msg
    type: str

  runner_on_skipped_msg_color:
    description:
      - Output color to be used for O(runner_on_skipped_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_skipped_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_SKIPPED_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_skipped_msg_color
    type: str

  runner_on_unreachable_msg:
    description: Output to be used for callback runner_on_unreachable.
    ini:
      - section: callback_diy
        key: runner_on_unreachable_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_UNREACHABLE_MSG
    vars:
      - name: ansible_callback_diy_runner_on_unreachable_msg
    type: str

  runner_on_unreachable_msg_color:
    description:
      - Output color to be used for O(runner_on_unreachable_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_unreachable_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_UNREACHABLE_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_unreachable_msg_color
    type: str

  playbook_on_start_msg:
    description: Output to be used for callback playbook_on_start.
    ini:
      - section: callback_diy
        key: playbook_on_start_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_START_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_start_msg
    type: str

  playbook_on_start_msg_color:
    description:
      - Output color to be used for O(playbook_on_start_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_start_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_START_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_start_msg_color
    type: str

  playbook_on_notify_msg:
    description: Output to be used for callback playbook_on_notify.
    ini:
      - section: callback_diy
        key: playbook_on_notify_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NOTIFY_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_notify_msg
    type: str

  playbook_on_notify_msg_color:
    description:
      - Output color to be used for O(playbook_on_notify_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_notify_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NOTIFY_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_notify_msg_color
    type: str

  playbook_on_no_hosts_matched_msg:
    description: Output to be used for callback playbook_on_no_hosts_matched.
    ini:
      - section: callback_diy
        key: playbook_on_no_hosts_matched_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_MATCHED_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_no_hosts_matched_msg
    type: str

  playbook_on_no_hosts_matched_msg_color:
    description:
      - Output color to be used for O(playbook_on_no_hosts_matched_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_no_hosts_matched_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_MATCHED_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_no_hosts_matched_msg_color
    type: str

  playbook_on_no_hosts_remaining_msg:
    description: Output to be used for callback playbook_on_no_hosts_remaining.
    ini:
      - section: callback_diy
        key: playbook_on_no_hosts_remaining_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_REMAINING_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_no_hosts_remaining_msg
    type: str

  playbook_on_no_hosts_remaining_msg_color:
    description:
      - Output color to be used for O(playbook_on_no_hosts_remaining_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_no_hosts_remaining_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_NO_HOSTS_REMAINING_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_no_hosts_remaining_msg_color
    type: str

  playbook_on_task_start_msg:
    description: Output to be used for callback playbook_on_task_start.
    ini:
      - section: callback_diy
        key: playbook_on_task_start_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_TASK_START_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_task_start_msg
    type: str

  playbook_on_task_start_msg_color:
    description:
      - Output color to be used for O(playbook_on_task_start_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_task_start_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_TASK_START_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_task_start_msg_color
    type: str

  playbook_on_handler_task_start_msg:
    description: Output to be used for callback playbook_on_handler_task_start.
    ini:
      - section: callback_diy
        key: playbook_on_handler_task_start_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_HANDLER_TASK_START_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_handler_task_start_msg
    type: str

  playbook_on_handler_task_start_msg_color:
    description:
      - Output color to be used for O(playbook_on_handler_task_start_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_handler_task_start_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_HANDLER_TASK_START_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_handler_task_start_msg_color
    type: str

  playbook_on_vars_prompt_msg:
    description: Output to be used for callback playbook_on_vars_prompt.
    ini:
      - section: callback_diy
        key: playbook_on_vars_prompt_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_VARS_PROMPT_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_vars_prompt_msg
    type: str

  playbook_on_vars_prompt_msg_color:
    description:
      - Output color to be used for O(playbook_on_vars_prompt_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_vars_prompt_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_VARS_PROMPT_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_vars_prompt_msg_color
    type: str

  playbook_on_play_start_msg:
    description: Output to be used for callback playbook_on_play_start.
    ini:
      - section: callback_diy
        key: playbook_on_play_start_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_PLAY_START_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_play_start_msg
    type: str

  playbook_on_play_start_msg_color:
    description:
      - Output color to be used for O(playbook_on_play_start_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_play_start_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_PLAY_START_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_play_start_msg_color
    type: str

  playbook_on_stats_msg:
    description: Output to be used for callback playbook_on_stats.
    ini:
      - section: callback_diy
        key: playbook_on_stats_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_STATS_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_stats_msg
    type: str

  playbook_on_stats_msg_color:
    description:
      - Output color to be used for O(playbook_on_stats_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_stats_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_STATS_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_stats_msg_color
    type: str

  on_file_diff_msg:
    description: Output to be used for callback on_file_diff.
    ini:
      - section: callback_diy
        key: on_file_diff_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_ON_FILE_DIFF_MSG
    vars:
      - name: ansible_callback_diy_on_file_diff_msg
    type: str

  on_file_diff_msg_color:
    description:
      - Output color to be used for O(on_file_diff_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: on_file_diff_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_ON_FILE_DIFF_MSG_COLOR
    vars:
      - name: ansible_callback_diy_on_file_diff_msg_color
    type: str

  playbook_on_include_msg:
    description: Output to be used for callback playbook_on_include.
    ini:
      - section: callback_diy
        key: playbook_on_include_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_INCLUDE_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_include_msg
    type: str

  playbook_on_include_msg_color:
    description:
      - Output color to be used for O(playbook_on_include_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_include_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_INCLUDE_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_include_msg_color
    type: str

  runner_item_on_ok_msg:
    description: Output to be used for callback runner_item_on_ok.
    ini:
      - section: callback_diy
        key: runner_item_on_ok_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_OK_MSG
    vars:
      - name: ansible_callback_diy_runner_item_on_ok_msg
    type: str

  runner_item_on_ok_msg_color:
    description:
      - Output color to be used for O(runner_item_on_ok_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_item_on_ok_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_OK_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_item_on_ok_msg_color
    type: str

  runner_item_on_failed_msg:
    description: Output to be used for callback runner_item_on_failed.
    ini:
      - section: callback_diy
        key: runner_item_on_failed_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_FAILED_MSG
    vars:
      - name: ansible_callback_diy_runner_item_on_failed_msg
    type: str

  runner_item_on_failed_msg_color:
    description:
      - Output color to be used for O(runner_item_on_failed_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_item_on_failed_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_FAILED_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_item_on_failed_msg_color
    type: str

  runner_item_on_skipped_msg:
    description: Output to be used for callback runner_item_on_skipped.
    ini:
      - section: callback_diy
        key: runner_item_on_skipped_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_SKIPPED_MSG
    vars:
      - name: ansible_callback_diy_runner_item_on_skipped_msg
    type: str

  runner_item_on_skipped_msg_color:
    description:
      - Output color to be used for O(runner_item_on_skipped_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_item_on_skipped_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ITEM_ON_SKIPPED_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_item_on_skipped_msg_color
    type: str

  runner_retry_msg:
    description: Output to be used for callback runner_retry.
    ini:
      - section: callback_diy
        key: runner_retry_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_RETRY_MSG
    vars:
      - name: ansible_callback_diy_runner_retry_msg
    type: str

  runner_retry_msg_color:
    description:
      - Output color to be used for O(runner_retry_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_retry_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_RETRY_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_retry_msg_color
    type: str

  runner_on_start_msg:
    description: Output to be used for callback runner_on_start.
    ini:
      - section: callback_diy
        key: runner_on_start_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_START_MSG
    vars:
      - name: ansible_callback_diy_runner_on_start_msg
    type: str

  runner_on_start_msg_color:
    description:
      - Output color to be used for O(runner_on_start_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_start_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_START_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_start_msg_color
    type: str

  runner_on_no_hosts_msg:
    description: Output to be used for callback runner_on_no_hosts.
    ini:
      - section: callback_diy
        key: runner_on_no_hosts_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_NO_HOSTS_MSG
    vars:
      - name: ansible_callback_diy_runner_on_no_hosts_msg
    type: str

  runner_on_no_hosts_msg_color:
    description:
      - Output color to be used for O(runner_on_no_hosts_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: runner_on_no_hosts_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_RUNNER_ON_NO_HOSTS_MSG_COLOR
    vars:
      - name: ansible_callback_diy_runner_on_no_hosts_msg_color
    type: str

  playbook_on_setup_msg:
    description: Output to be used for callback playbook_on_setup.
    ini:
      - section: callback_diy
        key: playbook_on_setup_msg
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_SETUP_MSG
    vars:
      - name: ansible_callback_diy_playbook_on_setup_msg
    type: str

  playbook_on_setup_msg_color:
    description:
      - Output color to be used for O(playbook_on_setup_msg).
      - Template should render a L(valid color value,#notes).
    ini:
      - section: callback_diy
        key: playbook_on_setup_msg_color
    env:
      - name: ANSIBLE_CALLBACK_DIY_PLAYBOOK_ON_SETUP_MSG_COLOR
    vars:
      - name: ansible_callback_diy_playbook_on_setup_msg_color
    type: str
a  
ansible.cfg: >
  # Enable plugin
  [defaults]
  stdout_callback=community.general.diy

  [callback_diy]
  # Output when playbook starts
  playbook_on_start_msg="DIY output(via ansible.cfg): playbook example: {{ ansible_callback_diy.playbook.file_name }}"
  playbook_on_start_msg_color=yellow

  # Comment out to allow default plugin output
  # playbook_on_play_start_msg="PLAY: starting play {{ ansible_callback_diy.play.name }}"

  # Accept on_skipped_msg or ansible_callback_diy_runner_on_skipped_msg as input vars
  # If neither are supplied, omit the option
  runner_on_skipped_msg="{{ on_skipped_msg | default(ansible_callback_diy_runner_on_skipped_msg) | default(omit) }}"

  # Newline after every callback
  # on_any_msg='{{ " " | join("\n") }}'

playbook.yml: >-
  ---
  - name: "Default plugin output: play example"
    hosts: localhost
    gather_facts: false
    tasks:
      - name:  Default plugin output
        ansible.builtin.debug:
          msg: default plugin output

  - name: Override from play vars
    hosts: localhost
    gather_facts: false
    vars:
      ansible_connection: local
      green: "\e[0m\e[38;5;82m"
      yellow: "\e[0m\e[38;5;11m"
      bright_purple: "\e[0m\e[38;5;105m"
      cyan: "\e[0m\e[38;5;51m"
      green_bg_black_fg: "\e[0m\e[48;5;40m\e[38;5;232m"
      yellow_bg_black_fg: "\e[0m\e[48;5;226m\e[38;5;232m"
      purple_bg_white_fg: "\e[0m\e[48;5;57m\e[38;5;255m"
      cyan_bg_black_fg: "\e[0m\e[48;5;87m\e[38;5;232m"
      magenta: "\e[38;5;198m"
      white: "\e[0m\e[38;5;255m"
      ansible_callback_diy_playbook_on_play_start_msg: "\n{{green}}DIY output(via play vars): play example: {{magenta}}{{ansible_callback_diy.play.name}}\n\n"
      ansible_callback_diy_playbook_on_task_start_msg: "DIY output(via play vars): task example: {{ ansible_callback_diy.task.name }}"
      ansible_callback_diy_playbook_on_task_start_msg_color: cyan
      ansible_callback_diy_playbook_on_stats_msg: |+2
                CUSTOM STATS
        ==============================
        {% for key in ansible_callback_diy.stats | sort %}
        {% if ansible_callback_diy.stats[key] %}
        {% if key == 'ok' %}
        {% set color_one = lookup('vars','green_bg_black_fg') %}
        {% set prefix = '      ' %}
        {% set suffix = '     ' %}
        {% set color_two = lookup('vars','green') %}
        {% elif key == 'changed' %}
        {% set color_one = lookup('vars','yellow_bg_black_fg') %}
        {% set prefix = '   ' %}
        {% set suffix = '   ' %}
        {% set color_two = lookup('vars','yellow') %}
        {% elif key == 'processed' %}
        {% set color_one = lookup('vars','purple_bg_white_fg') %}
        {% set prefix = '  ' %}
        {% set suffix = '  ' %}
        {% set color_two = lookup('vars','bright_purple') %}
        {% elif key == 'skipped' %}
        {% set color_one = lookup('vars','cyan_bg_black_fg') %}
        {% set prefix = '   ' %}
        {% set suffix = '   ' %}
        {% set color_two = lookup('vars','cyan') %}
        {% else %}
        {% set color_one = "" %}
        {% set prefix = "" %}
        {% set suffix = "" %}
        {% set color_two = "" %}
        {% endif %}
        {{ color_one }}{{ "%s%s%s" | format(prefix,key,suffix) }}{{ color_two }}: {{ ansible_callback_diy.stats[key] | to_nice_yaml }}
        {% endif %}
        {% endfor %}

    tasks:
      - name: Custom banner with default plugin result output
        ansible.builtin.debug:
          msg: "default plugin output: result example"

      - name: Override from task vars
        ansible.builtin.debug:
          msg: "example {{ two }}"
        changed_when: true
        vars:
          white_fg_red_bg: "\e[0m\e[48;5;1m"
          two: "{{ white_fg_red_bg }}    2    "
          ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
          ansible_callback_diy_playbook_on_task_start_msg_color: bright magenta
          ansible_callback_diy_runner_on_ok_msg: "DIY output(via task vars): result example: \n{{ ansible_callback_diy.result.output.msg }}\n"
          ansible_callback_diy_runner_on_ok_msg_color: "{{ 'yellow' if ansible_callback_diy.result.is_changed else 'bright green' }}"

      - name: Suppress output
        ansible.builtin.debug:
          msg: i should not be displayed
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: ""
          ansible_callback_diy_runner_on_ok_msg: ""

      - name: Using alias vars (see ansible.cfg)
        ansible.builtin.debug:
          msg:
        when: false
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: ""
          on_skipped_msg: "DIY output(via task vars): skipped example:\n\e[0m\e[38;5;4m\u25b6\u25b6 {{ ansible_callback_diy.result.task.name }}\n"
          on_skipped_msg_color: white

      - name: Just stdout
        ansible.builtin.command: echo some stdout
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: "\n"
          ansible_callback_diy_runner_on_ok_msg: "{{ ansible_callback_diy.result.output.stdout }}\n"

      - name: Multiline output
        ansible.builtin.debug:
          msg: "{{ multiline }}"
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
          multiline: "line\nline\nline"
          ansible_callback_diy_runner_on_ok_msg: |+2
            some
            {{ ansible_callback_diy.result.output.msg }}
            output

          ansible_callback_diy_playbook_on_task_start_msg_color: bright blue

      - name: Indentation
        ansible.builtin.debug:
          msg: "{{ item.msg }}"
        with_items:
          - { indent: 1, msg: one., color: red }
          - { indent: 2, msg: two.., color: yellow }
          - { indent: 3, msg: three..., color: bright yellow }
        vars:
          ansible_callback_diy_runner_item_on_ok_msg: "{{ ansible_callback_diy.result.output.msg | indent(item.indent, True) }}"
          ansible_callback_diy_runner_item_on_ok_msg_color: "{{ item.color }}"
          ansible_callback_diy_runner_on_ok_msg: "GO!!!"
          ansible_callback_diy_runner_on_ok_msg_color: bright green

      - name: Using lookup and template as file
        ansible.builtin.shell: "echo {% raw %}'output from {{ file_name }}'{% endraw %} > {{ file_name }}"
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
          file_name: diy_file_template_example
          ansible_callback_diy_runner_on_ok_msg: "{{ lookup('template', file_name) }}"

      - name: 'Look at top level vars available to the "runner_on_ok" callback'
        ansible.builtin.debug:
          msg: ''
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
          ansible_callback_diy_runner_on_ok_msg: |+2
            {% for var in (ansible_callback_diy.top_level_var_names|reject('match','vars|ansible_callback_diy.*')) | sort %}
            {{ green }}{{ var }}:
              {{ white }}{{ lookup('vars', var) }}

            {% endfor %}
          ansible_callback_diy_runner_on_ok_msg_color: white

      - name: 'Look at event data available to the "runner_on_ok" callback'
        ansible.builtin.debug:
          msg: ''
        vars:
          ansible_callback_diy_playbook_on_task_start_msg: "\nDIY output(via task vars): task example: {{ ansible_callback_diy.task.name }}"
          ansible_callback_diy_runner_on_ok_msg: |+2
            {% for key in ansible_callback_diy | sort %}
            {{ green }}{{ key }}:
              {{ white }}{{ ansible_callback_diy[key] }}

            {% endfor %}
N)contextmanager)Templar)VariableManager)CallbackModule)to_text)trust_as_templateTFc                      e Zd Zd Zd Zd Zy)DummyStdoutc                     y N )selfs    j/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/callback/diy.pyflushzDummyStdout.flush          c                     y r   r   )r   bs     r   writezDummyStdout.write  r   r   c                     y r   r   )r   ls     r   
writelineszDummyStdout.writelines"  r   r   N)__name__
__module____qualname__r   r   r   r   r   r   r   r     s    r   r   c                  h    e Zd ZdZdZdZdZdZed        Z	d Z
d Z fd	Zd
 Zd(dZ	 	 d)dZ fdZd( fd	Z fdZ fdZ fdZd Zd Zd Z fdZ fdZ fdZ fdZ fdZ fdZ fdZ fdZ fdZ  fdZ!d Z" fd Z#	 	 	 d* fd!	Z$d" Z%d# Z& fd$Z' fd%Z( fd&Z) fd'Z* xZ+S )+r   zd
    Callback plugin that allows you to supply your own custom callback templates to be output.
    g       @stdoutzcommunity.general.diyansible_callback_diyc              #  t   K   t         j                  }|rt               t         _        d  |t         _        y wr   )sysr   r   )r   enabledsaved_stdouts      r   _suppress_stdoutzCallbackModule._suppress_stdout0  s%     zz$CJ!
s   68c           	     n   i }t        j                  d      j                  j                  }|d d dk(  r|dd  n|}ddg}|D ]^  }| d| }|j	                  | j
                   d| | j                  |            }	|j                  || j                  ||	|      i       ` |j                  d|i       |S )	N      v2_msg	msg_color_)loadertemplate	variablesvars)	r!   	_getframef_codeco_namegetDIY_NS
get_optionupdate	_template)
r   r,   r.   _ret_calling_method_callback_type_callback_optionsoption_option_name_option_templates
             r   _get_output_specificationz(CallbackModule._get_output_specification8  s    --*11991@!1D1M/!"-Sb"K0' 
	F,-Qvh7L(}};;-q/-  KK)# "0 "  
	 	VY'(r   c                n    t               }|d   j                  d|      }|d   d uxr |d   |k7  xs ||u S )Nr/   omitr)   )objectr3   )r   specsentinelrA   s       r   
_using_diyzCallbackModule._using_diyN  sF    8F|1U4'Vd5kT.A.UTXEUVr   c                    t        t        t        |       t        j                  d      j
                  j                        S )Nr&   )hasattrsuperr   r!   r0   r1   r2   r   	__class__s    r   _parent_has_callbackz#CallbackModule._parent_has_callbackT  s,    u^T2CMM!4D4K4K4S4STTr   c                F    t        ||      }|j                  |ddd      S )Nr,   r.   TF)preserve_trailing_newlinesconvert_dataescape_backslashes)r   r-   )r   r,   r-   r.   _templars        r   r7   zCallbackModule._templateW  s2    &I>  '+#	 ! 
 	
r   c                    t        |d         }t        |      dkD  r"| j                  j                  ||d   |       y y )Nr)   r   r*   )r)   colorstderr)r   len_displaydisplay)r   rC   rT   _msgs       r   _outputzCallbackModule._output`  s>    tE{#t9q=MM!!d${2CF!S r   c
                T	   d dfd}
 G d dt               }i }t        |j                               }|j                         }|r5|j	                         j                  ||r|nt        |dd       |r|n|      }|j                  |       |j                  |j                  | j                  | j                  t        ri n |       i             || j                     j                  di i       g d	}|D ]-  }|| j                     d   j                  | ||
      i       / |rV|| j                     j                  di i       g d}|D ]-  }|| j                     d   j                  | ||
      i       / |rV|| j                     j                  di i       g d}|D ]-  }|| j                     d   j                  | ||
      i       / |rn|| j                     j                  di i       g d}|j                  r|	r
 |
||      }|D ]-  }|| j                     d   j                  | ||
      i       / |rV|| j                     j                  di i       g d}|D ]-  }|| j                     d   j                  | ||
      i       / |r|| j                     j                  di i       g d}|j                  r|	r
 |
||      }|D ]-  }|| j                     d   j                  | ||
      i       / || j                     d   j                  d|j                  |      i       |r|| j                     j                  di i       g d}|D ]-  }|| j                     d   j                  | ||
      i       / g d}|D ]-  }|| j                     d   j                  | ||      i       / || j                     d   j                  dt        |dd       i       |j                  |j                         |rV|| j                     j                  di i       g d}|D ]-  }|| j                     d   j                  | ||
      i       / || j                     j                  dt        |j                               i       |S )!Nc           	     h    |rt        | |t        | d| d             S |rt        | |      } |       S y )Nr+   )getattr)objattrmethod_methods       r   
_get_valuez,CallbackModule._get_vars.<locals>._get_valueg  s?    sD'#4&z4*HII!#v.y  r   c                    t        | dd       }|xs d}|D ]2  }t        |      t         | |            v s"|j                  |       4 |S )Nloop_controlitemr]   r^   )r\   strremove)r]   
attributes	_loop_varr^   ra   s       r   _remove_attr_ref_loopz7CallbackModule._get_vars.<locals>._remove_attr_ref_loopo  sX    ^T:I",fI" ,y>S$)G%HH%%d+, r   c                      e Zd Zd Zy)1CallbackModule._get_vars.<locals>.CallbackDIYDictc                    | S r   r   )r   memos     r   __deepcopy__z>CallbackModule._get_vars.<locals>.CallbackDIYDict.__deepcopy__z  s    r   N)r   r   r   ro   r   r   r   CallbackDIYDictrl   y  s    r   rp   )r,   _host)playhosttaskplaybook)entries	file_namebasedirre   rr   ).any_errors_fatalbecomebecome_flagsbecome_methodbecome_user
check_modecollections
connectiondebuggerdiffenvironment	fact_path	finalizedforce_handlersgather_factsgather_subsetgather_timeouthandlershostsignore_errorsignore_unreachableincluded_conditionalincluded_pathmax_fail_percentagemodule_defaultsnameno_log	only_tagsorderport
post_tasks	pre_tasksremote_userremoved_hostsrolesrun_onceserial	skip_tagssquashedstrategytagstasksuuid	validated
vars_filesvars_promptrs   )r   r   addressimplicitrt   )-actionry   argsasync	async_valrz   r{   r|   r}   changed_whenr~   r   r   r   delaydelegate_factsdelegate_tor   r   failed_whenr   r   r   looprc   	loop_withr   r   r   notifyparentpollr   registerr   retriesroler   r   r   untaggeduntilr   r   when)r]   rh   included_file)r   filenamer   is_rolert   handler)/r   ry   r   r   r   rz   r{   r|   r}   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   listenr   rc   r   r   r   r   notified_hostsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   is_host_notifiedresult)rs   rt   	task_name)
is_changed	is_failed
is_skippedis_unreachable)r]   r_   output_resultstats)	changedcustomdarkfailuresignoredok	processedrescuedskippedtop_level_var_names)NN)dictr   
get_loaderget_varsget_variable_managerr\   r6   r3   r4   SUPPORTS_DATA_TAGGINGr   r   r   listkeys)r   ru   rr   rs   rt   r   r   r   r   remove_attr_ref_looprj   rp   r8   _variable_manager_all_playbook_attributesr^   _play_attributes_host_attributes_task_attributes_included_file_attributes_handler_attributes_result_attributes_result_methodsr_   _stats_attributesra   s                             @r   	_get_varszCallbackModule._get_varse  s   	!		d 	 +83F3F3HI ))+,,.77"d(F!(gd 8 D
 	DDHHT[[4;;>SYhYj*klmT[[  *b!12B( 	^Dj)00$
xVZ8[1\]	^ $$fb\2
 J ) ZT[[!&)00$
tRV8W1XYZ $$fb\2F( ZT[[!&)00$
tRV8W1XYZ $$fb\2	 ( yy1#8TN^#_ ( ZT[[!&)00$
tRV8W1XYZ $$or%:;(X%1 T[[!/2994%B ;  $$i_5
#+ || 4&;GZ'\# , `T[[!),33T:'X\;]4^_` i(//1CWE]E]^bEc0de$$h^4!>* ^T[[!(+22D*VZ:[3\]^ ZO) dT[[!(+22FJ6Z`<a3bcd h'..'&)UY:Z/[\KK'$$gr]3!J * \T[[!'*114TX9Y2Z[\ 	T[[  "7diik9J!KLr   c                   | j                  | j                  | j                  d         | _        | j                  | j                        r| j	                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | &  |i | d d d        y y # 1 sw Y   y xY wNr/   rM   rC   r"   )
r?   _diy_loader	_diy_specrE   rY   rK   r$   rH   r   	v2_on_any)r   r   kwargsrJ   s      r   r   zCallbackModule.v2_on_any  s    77##nnV, 8 

 ???/LLdnnL-$$&&&tDNN/S&T Gnd5tFvFG G 'G Gs   %CCc           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                  |        | j                         rJ| j                  | j                  | j                              5  t        t        | 7  ||       d d d        y y # 1 sw Y   y xY w)Nru   rr   rt   r   rM   r   )rC   rT   r   )r?   r   r   _diy_playbook	_diy_play	_diy_taskr   rE   rY   rK   r$   rH   r   v2_runner_on_failed)r   r   r   rJ   s      r   r   z"CallbackModule.v2_runner_on_failed	  s    77##nn++^^^^	 %  8 
 ???/LLdnn-6GLI$$&&&tDNN/S&T Wnd?VW W 'W Ws   C**C3c           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wNr   rM   r   r   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_on_okr   r   rJ   s     r   r   zCallbackModule.v2_runner_on_ok      77##nn++^^^^	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T Dnd;FCD D 'D D   	C''C0c           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_on_skippedr   s     r   r   z#CallbackModule.v2_runner_on_skipped-  s    77##nn++^^^^	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T Ind@HI I 'I Ir   c           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_on_unreachabler   s     r   r  z'CallbackModule.v2_runner_on_unreachable?  s    77##nn++^^^^	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T MndDVLM M 'M Mr   c                     y r   r   r   r   s     r   v2_runner_on_async_pollz&CallbackModule.v2_runner_on_async_pollR  r   r   c                     y r   r   r  s     r   v2_runner_on_async_okz$CallbackModule.v2_runner_on_async_okV  r   r   c                     y r   r   r  s     r   v2_runner_on_async_failedz(CallbackModule.v2_runner_on_async_failedZ  r   r   c           
        | j                  | j                  | j                  | j                  | j                  | j
                  |d            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wNF)ru   rr   rt   r   r   rM   r   r   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_item_on_okr   s     r   r  z#CallbackModule.v2_runner_item_on_ok]  s    77##nn++^^^^%* %  8 	
 ???/LLdnnL-$$&&&tDNN/S&T Ind@HI I 'I I   
C((C1c           
        | j                  | j                  | j                  | j                  | j                  | j
                  |d            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr  )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_item_on_failedr   s     r   r  z'CallbackModule.v2_runner_item_on_failedp  s    77##nn++^^^^%* %  8 	
 ???/LLdnnL-$$&&&tDNN/S&T MndDVLM M 'M Mr  c           
        | j                  | j                  | j                  | j                  | j                  | j
                  |d            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr  )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_item_on_skippedr   s     r   r  z(CallbackModule.v2_runner_item_on_skipped  s    77##nn++^^^^%* %  8 	
 ???/LLdnnL-$$&&&tDNN/S&T NndEfMN N 'N Nr  c           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_retryr   s     r   r  zCallbackModule.v2_runner_retry  r   r   c           	        || _         || _        | j                  | j                  | j	                  | j
                  | j                  | j                   | j                              | _        | j                  | j                        r| j                  | j                         | j                         rJ| j                  | j                  | j                              5  t        t        | ;  ||       d d d        y y # 1 sw Y   y xY w)N)ru   rr   rs   rt   rM   r   r   )	_diy_hostr   r?   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_runner_on_start)r   rs   rt   rJ   s      r   r  z!CallbackModule.v2_runner_on_start  s    77##nn++^^^^^^	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T Knd>tTJK K 'K K   !D  D	c                   || _         | j                   j                         | _        | j                  | j                  | j	                  | j                               | _        | j                  | j
                        r| j                  | j
                         | j                         rI| j                  | j                  | j
                              5  t        t        | 3  |       d d d        y y # 1 sw Y   y xY w)N)ru   rM   r   r   )r   r   r   r?   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_start)r   ru   rJ   s     r   r  z#CallbackModule.v2_playbook_on_start  s    %--88:77##nn++ %  8 
 ???/LLdnnL-$$&&&tDNN/S&T Knd@JK K 'K Ks   C66C?c           	        || _         || _        | j                  | j                  | j	                  | j
                  | j                  | j                  | j                               | _        | j                  | j                        r| j                  | j                         | j                         rJ| j                  | j                  | j                              5  t        t        | ;  ||       d d d        y y # 1 sw Y   y xY w)N)ru   rr   rs   r   rM   r   r   )_diy_handlerr  r?   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_notify)r   r   rs   rJ   s      r   r  z$CallbackModule.v2_playbook_on_notify  s    #77##nn++^^^^))	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T QndA'4PQ Q 'Q Qr  c                   | j                  | j                  | j                  d         | _        | j                  | j                        r| j	                  | j                         | j                         rH| j                  | j                  | j                              5  t        t        | '          d d d        y y # 1 sw Y   y xY wr   )
r?   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_no_hosts_matchedrI   s    r   r  z.CallbackModule.v2_playbook_on_no_hosts_matched  s    77##nnV, 8 

 ???/LLdnnL-$$&&&tDNN/S&T NndKMN N 'N N   %CCc                   | j                  | j                  | j                  d         | _        | j                  | j                        r| j	                  | j                         | j                         rH| j                  | j                  | j                              5  t        t        | '          d d d        y y # 1 sw Y   y xY wr   )
r?   r   r   rE   rY   rK   r$   rH   r   !v2_playbook_on_no_hosts_remainingrI   s    r   r!  z0CallbackModule.v2_playbook_on_no_hosts_remaining  s    77##nnV, 8 

 ???/LLdnnL-$$&&&tDNN/S&T PndMOP P 'P Pr  c                   || _         | j                  | j                  | j                  | j                  | j
                  | j                               | _        | j                  | j                        r| j                  | j                         | j                         rJ| j                  | j                  | j                              5  t        t        | 7  ||       d d d        y y # 1 sw Y   y xY wN)ru   rr   rt   rM   r   r   )r   r?   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_task_start)r   rt   is_conditionalrJ   s      r   r$  z(CallbackModule.v2_playbook_on_task_start  s    77##nn++^^^^ %  8 
 ???/LLdnnL-$$&&&tDNN/S&T \ndEdN[\ \ '\ \s   C..C7c                     y r   r   )r   rt   s     r   !v2_playbook_on_cleanup_task_startz0CallbackModule.v2_playbook_on_cleanup_task_start  r   r   c                   || _         | j                  | j                  | j                  | j                  | j
                  | j                               | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr#  )r   r?   r   r   r   r   r   rE   rY   rK   r$   rH   r   !v2_playbook_on_handler_task_start)r   rt   rJ   s     r   r)  z0CallbackModule.v2_playbook_on_handler_task_start  s    77##nn++^^^^ %  8 
 ???/LLdnnL-$$&&&tDNN/S&T TndMdST T 'T T   C--C6c
                   | j                  | j                  | j                  d         | _        | j                  | j                        r| j	                  | j                         | j                         rQ| j                  | j                  | j                              5  t        t        | '  |||||||||		       d d d        y y # 1 sw Y   y xY wr   )
r?   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_vars_prompt)r   varnameprivatepromptencryptconfirm	salt_sizesaltdefaultunsaferJ   s             r   r,  z)CallbackModule.v2_playbook_on_vars_prompt(  s     77##nnV, 8 

 ???/LLdnnL-$$&&&tDNN/S&T ndFWfgYg  ' s   %CCc                     y r   r   )r   r   imported_files      r   v2_playbook_on_import_for_hostz-CallbackModule.v2_playbook_on_import_for_host<  r   r   c                     y r   r   )r   r   missing_files      r   "v2_playbook_on_not_import_for_hostz1CallbackModule.v2_playbook_on_not_import_for_host@  r   r   c                   || _         | j                  | j                  | j                  | j                  | j                               | _        | j                  | j
                        r| j                  | j
                         | j                         rI| j                  | j                  | j
                              5  t        t        | 3  |       d d d        y y # 1 sw Y   y xY w)N)ru   rr   rM   r   r   )r   r?   r   r   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_play_start)r   rr   rJ   s     r   r=  z(CallbackModule.v2_playbook_on_play_startC  s    77##nn++^^ %  8 
 ???/LLdnnL-$$&&&tDNN/S&T LndEdKL L 'L Ls   C""C+c                   || _         | j                  | j                  | j                  | j                  | j
                  | j                               | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY w)N)ru   rr   r   rM   r   r   )
_diy_statsr?   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_playbook_on_stats)r   r   rJ   s     r   r@  z#CallbackModule.v2_playbook_on_statsU  s    77##nn++^^oo %  8 
 ???/LLdnnL-$$&&&tDNN/S&T Hnd@GH H 'H Hr*  c           	        || _         | j                  | j                  | j                  | j                  | j
                  | j                   j                  | j                               | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | ;  |       d d d        y y # 1 sw Y   y xY w)N)ru   rr   rt   r   rM   r   r   )_diy_included_filer?   r   r   r   r   _taskr   rE   rY   rK   r$   rH   r   v2_playbook_on_include)r   r   rJ   s     r   rD  z%CallbackModule.v2_playbook_on_includeh  s    "/77##nn++^^,,22"55	 %  8 
 ???/LLdnnL-$$&&&tDNN/S&T RndB=QR R 'R Rs   $DDc           	        | j                  | j                  | j                  | j                  | j                  | j
                  |            | _        | j                  | j                        r| j                  | j                         | j                         rI| j                  | j                  | j                              5  t        t        | 7  |       d d d        y y # 1 sw Y   y xY wr   )r?   r   r   r   r   r   r   rE   rY   rK   r$   rH   r   v2_on_file_diffr   s     r   rF  zCallbackModule.v2_on_file_diff|  r   r   )F)NNNNNNNT)TNNFNNNN),r   r   r   __doc__CALLBACK_VERSIONCALLBACK_TYPECALLBACK_NAMEr4   r   r$   r?   rE   rK   r7   rY   r   r   r   r   r   r  r  r  r	  r  r  r  r  r  r  r  r  r!  r$  r'  r)  r,  r8  r;  r=  r@  rD  rF  __classcell__)rJ   s   @r   r   r   &  s    M+M#F" ",WU
T
 RVNRUnGW$D$I$M&I&M&N&D$K*K$Q*NP\(T& VZUY*.(L$H&R(D Dr   r   )
__future__r   DOCUMENTATIONEXAMPLESr!   
contextlibr   ansible.templater   ansible.vars.managerr    ansible.plugins.callback.defaultr   Default+ansible.module_utils.common.text.convertersr   r	   r   ImportErrorrB   r   r   r   r   <module>rV     sq    #L	\tl  % $ 0 F ?"2 
& f	DW f	D  "!"s   A AA