normalize docs in callback plugins (#9455)
* normalize docs in callback plugins Normalize doc blocks for plugins * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>pull/9431/head
parent
29e3226718
commit
d887930e49
|
@ -7,40 +7,41 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: cgroup_memory_recap
|
name: cgroup_memory_recap
|
||||||
type: aggregate
|
type: aggregate
|
||||||
requirements:
|
requirements:
|
||||||
- whitelist in configuration
|
- whitelist in configuration
|
||||||
- cgroups
|
- cgroups
|
||||||
short_description: Profiles maximum memory usage of tasks and full execution using cgroups
|
short_description: Profiles maximum memory usage of tasks and full execution using cgroups
|
||||||
description:
|
description:
|
||||||
- This is an ansible callback plugin that profiles maximum memory usage of ansible and individual tasks, and displays a recap at the end using cgroups.
|
- This is an Ansible callback plugin that profiles maximum memory usage of Ansible and individual tasks, and displays a
|
||||||
notes:
|
recap at the end using cgroups.
|
||||||
- Requires ansible to be run from within a cgroup, such as with C(cgexec -g memory:ansible_profile ansible-playbook ...).
|
notes:
|
||||||
- This cgroup should only be used by ansible to get accurate results.
|
- Requires ansible to be run from within a C(cgroup), such as with C(cgexec -g memory:ansible_profile ansible-playbook ...).
|
||||||
- To create the cgroup, first use a command such as C(sudo cgcreate -a ec2-user:ec2-user -t ec2-user:ec2-user -g memory:ansible_profile).
|
- This C(cgroup) should only be used by Ansible to get accurate results.
|
||||||
options:
|
- To create the C(cgroup), first use a command such as C(sudo cgcreate -a ec2-user:ec2-user -t ec2-user:ec2-user -g memory:ansible_profile).
|
||||||
max_mem_file:
|
options:
|
||||||
required: true
|
max_mem_file:
|
||||||
description: Path to cgroups C(memory.max_usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.max_usage_in_bytes).
|
required: true
|
||||||
type: str
|
description: Path to cgroups C(memory.max_usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.max_usage_in_bytes).
|
||||||
env:
|
type: str
|
||||||
- name: CGROUP_MAX_MEM_FILE
|
env:
|
||||||
ini:
|
- name: CGROUP_MAX_MEM_FILE
|
||||||
- section: callback_cgroupmemrecap
|
ini:
|
||||||
key: max_mem_file
|
- section: callback_cgroupmemrecap
|
||||||
cur_mem_file:
|
key: max_mem_file
|
||||||
required: true
|
cur_mem_file:
|
||||||
description: Path to C(memory.usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.usage_in_bytes).
|
required: true
|
||||||
type: str
|
description: Path to C(memory.usage_in_bytes) file. Example V(/sys/fs/cgroup/memory/ansible_profile/memory.usage_in_bytes).
|
||||||
env:
|
type: str
|
||||||
- name: CGROUP_CUR_MEM_FILE
|
env:
|
||||||
ini:
|
- name: CGROUP_CUR_MEM_FILE
|
||||||
- section: callback_cgroupmemrecap
|
ini:
|
||||||
key: cur_mem_file
|
- section: callback_cgroupmemrecap
|
||||||
'''
|
key: cur_mem_file
|
||||||
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
|
|
@ -7,17 +7,17 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: context_demo
|
name: context_demo
|
||||||
type: aggregate
|
type: aggregate
|
||||||
short_description: demo callback that adds play/task context
|
short_description: demo callback that adds play/task context
|
||||||
description:
|
description:
|
||||||
- Displays some play and task context along with normal output.
|
- Displays some play and task context along with normal output.
|
||||||
- This is mostly for demo purposes.
|
- This is mostly for demo purposes.
|
||||||
requirements:
|
requirements:
|
||||||
- whitelist in configuration
|
- whitelist in configuration
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,20 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: counter_enabled
|
name: counter_enabled
|
||||||
type: stdout
|
type: stdout
|
||||||
short_description: adds counters to the output items (tasks and hosts/task)
|
short_description: adds counters to the output items (tasks and hosts/task)
|
||||||
description:
|
description:
|
||||||
- Use this callback when you need a kind of progress bar on a large environments.
|
- Use this callback when you need a kind of progress bar on a large environments.
|
||||||
- You will know how many tasks has the playbook to run, and which one is actually running.
|
- You will know how many tasks has the playbook to run, and which one is actually running.
|
||||||
- You will know how many hosts may run a task, and which of them is actually running.
|
- You will know how many hosts may run a task, and which of them is actually running.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- default_callback
|
- default_callback
|
||||||
requirements:
|
requirements:
|
||||||
- set as stdout callback in C(ansible.cfg) (C(stdout_callback = counter_enabled))
|
- set as stdout callback in C(ansible.cfg) (C(stdout_callback = counter_enabled))
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
|
|
|
@ -7,23 +7,22 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
name: default_without_diff
|
name: default_without_diff
|
||||||
type: stdout
|
type: stdout
|
||||||
short_description: The default ansible callback without diff output
|
short_description: The default ansible callback without diff output
|
||||||
version_added: 8.4.0
|
version_added: 8.4.0
|
||||||
description:
|
description:
|
||||||
- This is basically the default ansible callback plugin (P(ansible.builtin.default#callback)) without
|
- This is basically the default ansible callback plugin (P(ansible.builtin.default#callback)) without showing diff output.
|
||||||
showing diff output. This can be useful when using another callback which sends more detailed information
|
This can be useful when using another callback which sends more detailed information to another service, like the L(ARA,
|
||||||
to another service, like the L(ARA, https://ara.recordsansible.org/) callback, and you want diff output
|
https://ara.recordsansible.org/) callback, and you want diff output sent to that plugin but not shown on the console output.
|
||||||
sent to that plugin but not shown on the console output.
|
author: Felix Fontein (@felixfontein)
|
||||||
author: Felix Fontein (@felixfontein)
|
extends_documentation_fragment:
|
||||||
extends_documentation_fragment:
|
- ansible.builtin.default_callback
|
||||||
- ansible.builtin.default_callback
|
- ansible.builtin.result_format_callback
|
||||||
- ansible.builtin.result_format_callback
|
"""
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r"""
|
||||||
# Enable callback in ansible.cfg:
|
# Enable callback in ansible.cfg:
|
||||||
ansible_config: |
|
ansible_config: |
|
||||||
[defaults]
|
[defaults]
|
||||||
|
@ -32,7 +31,7 @@ ansible_config: |
|
||||||
# Enable callback with environment variables:
|
# Enable callback with environment variables:
|
||||||
environment_variable: |
|
environment_variable: |
|
||||||
ANSIBLE_STDOUT_CALLBACK=community.general.default_without_diff
|
ANSIBLE_STDOUT_CALLBACK=community.general.default_without_diff
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible.plugins.callback.default import CallbackModule as Default
|
from ansible.plugins.callback.default import CallbackModule as Default
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,19 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: dense
|
name: dense
|
||||||
type: stdout
|
type: stdout
|
||||||
short_description: minimal stdout output
|
short_description: minimal stdout output
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- default_callback
|
- default_callback
|
||||||
description:
|
description:
|
||||||
- When in verbose mode it will act the same as the default callback.
|
- When in verbose mode it will act the same as the default callback.
|
||||||
author:
|
author:
|
||||||
- Dag Wieers (@dagwieers)
|
- Dag Wieers (@dagwieers)
|
||||||
requirements:
|
requirements:
|
||||||
- set as stdout in configuration
|
- set as stdout in configuration
|
||||||
'''
|
"""
|
||||||
|
|
||||||
HAS_OD = False
|
HAS_OD = False
|
||||||
try:
|
try:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,69 +5,69 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Victor Martinez (@v1v) <VictorMartinezRubio@gmail.com>
|
author: Victor Martinez (@v1v) <VictorMartinezRubio@gmail.com>
|
||||||
name: elastic
|
name: elastic
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Create distributed traces for each Ansible task in Elastic APM
|
short_description: Create distributed traces for each Ansible task in Elastic APM
|
||||||
version_added: 3.8.0
|
version_added: 3.8.0
|
||||||
|
description:
|
||||||
|
- This callback creates distributed traces for each Ansible task in Elastic APM.
|
||||||
|
- You can configure the plugin with environment variables.
|
||||||
|
- See U(https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html).
|
||||||
|
options:
|
||||||
|
hide_task_arguments:
|
||||||
|
default: false
|
||||||
|
type: bool
|
||||||
description:
|
description:
|
||||||
- This callback creates distributed traces for each Ansible task in Elastic APM.
|
- Hide the arguments for a task.
|
||||||
- You can configure the plugin with environment variables.
|
env:
|
||||||
- See U(https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html).
|
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
||||||
options:
|
apm_service_name:
|
||||||
hide_task_arguments:
|
default: ansible
|
||||||
default: false
|
type: str
|
||||||
type: bool
|
description:
|
||||||
description:
|
- The service name resource attribute.
|
||||||
- Hide the arguments for a task.
|
env:
|
||||||
env:
|
- name: ELASTIC_APM_SERVICE_NAME
|
||||||
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
apm_server_url:
|
||||||
apm_service_name:
|
type: str
|
||||||
default: ansible
|
description:
|
||||||
type: str
|
- Use the APM server and its environment variables.
|
||||||
description:
|
env:
|
||||||
- The service name resource attribute.
|
- name: ELASTIC_APM_SERVER_URL
|
||||||
env:
|
apm_secret_token:
|
||||||
- name: ELASTIC_APM_SERVICE_NAME
|
type: str
|
||||||
apm_server_url:
|
description:
|
||||||
type: str
|
- Use the APM server token.
|
||||||
description:
|
env:
|
||||||
- Use the APM server and its environment variables.
|
- name: ELASTIC_APM_SECRET_TOKEN
|
||||||
env:
|
apm_api_key:
|
||||||
- name: ELASTIC_APM_SERVER_URL
|
type: str
|
||||||
apm_secret_token:
|
description:
|
||||||
type: str
|
- Use the APM API key.
|
||||||
description:
|
env:
|
||||||
- Use the APM server token
|
- name: ELASTIC_APM_API_KEY
|
||||||
env:
|
apm_verify_server_cert:
|
||||||
- name: ELASTIC_APM_SECRET_TOKEN
|
default: true
|
||||||
apm_api_key:
|
type: bool
|
||||||
type: str
|
description:
|
||||||
description:
|
- Verifies the SSL certificate if an HTTPS connection.
|
||||||
- Use the APM API key
|
env:
|
||||||
env:
|
- name: ELASTIC_APM_VERIFY_SERVER_CERT
|
||||||
- name: ELASTIC_APM_API_KEY
|
traceparent:
|
||||||
apm_verify_server_cert:
|
type: str
|
||||||
default: true
|
description:
|
||||||
type: bool
|
- The L(W3C Trace Context header traceparent,https://www.w3.org/TR/trace-context-1/#traceparent-header).
|
||||||
description:
|
env:
|
||||||
- Verifies the SSL certificate if an HTTPS connection.
|
- name: TRACEPARENT
|
||||||
env:
|
requirements:
|
||||||
- name: ELASTIC_APM_VERIFY_SERVER_CERT
|
- elastic-apm (Python library)
|
||||||
traceparent:
|
"""
|
||||||
type: str
|
|
||||||
description:
|
|
||||||
- The L(W3C Trace Context header traceparent,https://www.w3.org/TR/trace-context-1/#traceparent-header).
|
|
||||||
env:
|
|
||||||
- name: TRACEPARENT
|
|
||||||
requirements:
|
|
||||||
- elastic-apm (Python library)
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: |
|
examples: |-
|
||||||
Enable the plugin in ansible.cfg:
|
Enable the plugin in ansible.cfg:
|
||||||
[defaults]
|
[defaults]
|
||||||
callbacks_enabled = community.general.elastic
|
callbacks_enabled = community.general.elastic
|
||||||
|
@ -76,7 +76,7 @@ examples: |
|
||||||
export ELASTIC_APM_SERVER_URL=<your APM server URL)>
|
export ELASTIC_APM_SERVER_URL=<your APM server URL)>
|
||||||
export ELASTIC_APM_SERVICE_NAME=your_service_name
|
export ELASTIC_APM_SERVICE_NAME=your_service_name
|
||||||
export ELASTIC_APM_API_KEY=your_APM_API_KEY
|
export ELASTIC_APM_API_KEY=your_APM_API_KEY
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
import socket
|
import socket
|
||||||
|
|
|
@ -7,42 +7,42 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: jabber
|
name: jabber
|
||||||
type: notification
|
type: notification
|
||||||
short_description: post task events to a jabber server
|
short_description: post task events to a Jabber server
|
||||||
description:
|
description:
|
||||||
- The chatty part of ChatOps with a Hipchat server as a target.
|
- The chatty part of ChatOps with a Hipchat server as a target.
|
||||||
- This callback plugin sends status updates to a HipChat channel during playbook execution.
|
- This callback plugin sends status updates to a HipChat channel during playbook execution.
|
||||||
requirements:
|
requirements:
|
||||||
- xmpp (Python library U(https://github.com/ArchipelProject/xmpppy))
|
- xmpp (Python library U(https://github.com/ArchipelProject/xmpppy))
|
||||||
options:
|
options:
|
||||||
server:
|
server:
|
||||||
description: connection info to jabber server
|
description: Connection info to Jabber server.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: JABBER_SERV
|
- name: JABBER_SERV
|
||||||
user:
|
user:
|
||||||
description: Jabber user to authenticate as
|
description: Jabber user to authenticate as.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: JABBER_USER
|
- name: JABBER_USER
|
||||||
password:
|
password:
|
||||||
description: Password for the user to the jabber server
|
description: Password for the user to the Jabber server.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: JABBER_PASS
|
- name: JABBER_PASS
|
||||||
to:
|
to:
|
||||||
description: chat identifier that will receive the message
|
description: Chat identifier that will receive the message.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: JABBER_TO
|
- name: JABBER_TO
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -7,27 +7,27 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: log_plays
|
name: log_plays
|
||||||
type: notification
|
type: notification
|
||||||
short_description: write playbook output to log file
|
short_description: write playbook output to log file
|
||||||
description:
|
description:
|
||||||
- This callback writes playbook output to a file per host in the C(/var/log/ansible/hosts) directory.
|
- This callback writes playbook output to a file per host in the C(/var/log/ansible/hosts) directory.
|
||||||
requirements:
|
requirements:
|
||||||
- Whitelist in configuration
|
- Whitelist in configuration
|
||||||
- A writeable C(/var/log/ansible/hosts) directory by the user executing Ansible on the controller
|
- A writeable C(/var/log/ansible/hosts) directory by the user executing Ansible on the controller
|
||||||
options:
|
options:
|
||||||
log_folder:
|
log_folder:
|
||||||
default: /var/log/ansible/hosts
|
default: /var/log/ansible/hosts
|
||||||
description: The folder where log files will be created.
|
description: The folder where log files will be created.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_LOG_FOLDER
|
- name: ANSIBLE_LOG_FOLDER
|
||||||
ini:
|
ini:
|
||||||
- section: callback_log_plays
|
- section: callback_log_plays
|
||||||
key: log_folder
|
key: log_folder
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -6,41 +6,41 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: loganalytics
|
name: loganalytics
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Posts task results to Azure Log Analytics
|
short_description: Posts task results to Azure Log Analytics
|
||||||
author: "Cyrus Li (@zhcli) <cyrus1006@gmail.com>"
|
author: "Cyrus Li (@zhcli) <cyrus1006@gmail.com>"
|
||||||
description:
|
description:
|
||||||
- This callback plugin will post task results in JSON formatted to an Azure Log Analytics workspace.
|
- This callback plugin will post task results in JSON formatted to an Azure Log Analytics workspace.
|
||||||
- Credits to authors of splunk callback plugin.
|
- Credits to authors of splunk callback plugin.
|
||||||
version_added: "2.4.0"
|
version_added: "2.4.0"
|
||||||
requirements:
|
requirements:
|
||||||
- Whitelisting this callback plugin.
|
- Whitelisting this callback plugin.
|
||||||
- An Azure log analytics work space has been established.
|
- An Azure log analytics work space has been established.
|
||||||
options:
|
options:
|
||||||
workspace_id:
|
workspace_id:
|
||||||
description: Workspace ID of the Azure log analytics workspace.
|
description: Workspace ID of the Azure log analytics workspace.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: WORKSPACE_ID
|
- name: WORKSPACE_ID
|
||||||
ini:
|
ini:
|
||||||
- section: callback_loganalytics
|
- section: callback_loganalytics
|
||||||
key: workspace_id
|
key: workspace_id
|
||||||
shared_key:
|
shared_key:
|
||||||
description: Shared key to connect to Azure log analytics workspace.
|
description: Shared key to connect to Azure log analytics workspace.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: WORKSPACE_SHARED_KEY
|
- name: WORKSPACE_SHARED_KEY
|
||||||
ini:
|
ini:
|
||||||
- section: callback_loganalytics
|
- section: callback_loganalytics
|
||||||
key: shared_key
|
key: shared_key
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: |
|
examples: |-
|
||||||
Whitelist the plugin in ansible.cfg:
|
Whitelist the plugin in ansible.cfg:
|
||||||
[defaults]
|
[defaults]
|
||||||
callback_whitelist = community.general.loganalytics
|
callback_whitelist = community.general.loganalytics
|
||||||
|
@ -51,7 +51,7 @@ examples: |
|
||||||
[callback_loganalytics]
|
[callback_loganalytics]
|
||||||
workspace_id = 01234567-0123-0123-0123-01234567890a
|
workspace_id = 01234567-0123-0123-0123-01234567890a
|
||||||
shared_key = dZD0kCbKl3ehZG6LHFMuhtE0yHiFCmetzFMc2u+roXIUQuatqU924SsAAAAPemhjbGlAemhjbGktTUJQAQIDBA==
|
shared_key = dZD0kCbKl3ehZG6LHFMuhtE0yHiFCmetzFMc2u+roXIUQuatqU924SsAAAAPemhjbGlAemhjbGktTUJQAQIDBA==
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
|
|
|
@ -6,56 +6,56 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: logdna
|
name: logdna
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends playbook logs to LogDNA
|
short_description: Sends playbook logs to LogDNA
|
||||||
description:
|
description:
|
||||||
- This callback will report logs from playbook actions, tasks, and events to LogDNA (U(https://app.logdna.com)).
|
- This callback will report logs from playbook actions, tasks, and events to LogDNA (U(https://app.logdna.com)).
|
||||||
requirements:
|
requirements:
|
||||||
- LogDNA Python Library (U(https://github.com/logdna/python))
|
- LogDNA Python Library (U(https://github.com/logdna/python))
|
||||||
- whitelisting in configuration
|
- whitelisting in configuration
|
||||||
options:
|
options:
|
||||||
conf_key:
|
conf_key:
|
||||||
required: true
|
required: true
|
||||||
description: LogDNA Ingestion Key.
|
description: LogDNA Ingestion Key.
|
||||||
type: string
|
type: string
|
||||||
env:
|
env:
|
||||||
- name: LOGDNA_INGESTION_KEY
|
- name: LOGDNA_INGESTION_KEY
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logdna
|
- section: callback_logdna
|
||||||
key: conf_key
|
key: conf_key
|
||||||
plugin_ignore_errors:
|
plugin_ignore_errors:
|
||||||
required: false
|
required: false
|
||||||
description: Whether to ignore errors on failing or not.
|
description: Whether to ignore errors on failing or not.
|
||||||
type: boolean
|
type: boolean
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_IGNORE_ERRORS
|
- name: ANSIBLE_IGNORE_ERRORS
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logdna
|
- section: callback_logdna
|
||||||
key: plugin_ignore_errors
|
key: plugin_ignore_errors
|
||||||
default: false
|
default: false
|
||||||
conf_hostname:
|
conf_hostname:
|
||||||
required: false
|
required: false
|
||||||
description: Alternative Host Name; the current host name by default.
|
description: Alternative Host Name; the current host name by default.
|
||||||
type: string
|
type: string
|
||||||
env:
|
env:
|
||||||
- name: LOGDNA_HOSTNAME
|
- name: LOGDNA_HOSTNAME
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logdna
|
- section: callback_logdna
|
||||||
key: conf_hostname
|
key: conf_hostname
|
||||||
conf_tags:
|
conf_tags:
|
||||||
required: false
|
required: false
|
||||||
description: Tags.
|
description: Tags.
|
||||||
type: string
|
type: string
|
||||||
env:
|
env:
|
||||||
- name: LOGDNA_TAGS
|
- name: LOGDNA_TAGS
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logdna
|
- section: callback_logdna
|
||||||
key: conf_tags
|
key: conf_tags
|
||||||
default: ansible
|
default: ansible
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -6,79 +6,77 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: logentries
|
name: logentries
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends events to Logentries
|
short_description: Sends events to Logentries
|
||||||
|
description:
|
||||||
|
- This callback plugin will generate JSON objects and send them to Logentries using TCP for auditing/debugging purposes.
|
||||||
|
requirements:
|
||||||
|
- whitelisting in configuration
|
||||||
|
- certifi (Python library)
|
||||||
|
- flatdict (Python library), if you want to use the O(flatten) option
|
||||||
|
options:
|
||||||
|
api:
|
||||||
|
description: URI to the Logentries API.
|
||||||
|
type: str
|
||||||
|
env:
|
||||||
|
- name: LOGENTRIES_API
|
||||||
|
default: data.logentries.com
|
||||||
|
ini:
|
||||||
|
- section: callback_logentries
|
||||||
|
key: api
|
||||||
|
port:
|
||||||
|
description: HTTP port to use when connecting to the API.
|
||||||
|
type: int
|
||||||
|
env:
|
||||||
|
- name: LOGENTRIES_PORT
|
||||||
|
default: 80
|
||||||
|
ini:
|
||||||
|
- section: callback_logentries
|
||||||
|
key: port
|
||||||
|
tls_port:
|
||||||
|
description: Port to use when connecting to the API when TLS is enabled.
|
||||||
|
type: int
|
||||||
|
env:
|
||||||
|
- name: LOGENTRIES_TLS_PORT
|
||||||
|
default: 443
|
||||||
|
ini:
|
||||||
|
- section: callback_logentries
|
||||||
|
key: tls_port
|
||||||
|
token:
|
||||||
|
description: The logentries C(TCP token).
|
||||||
|
type: str
|
||||||
|
env:
|
||||||
|
- name: LOGENTRIES_ANSIBLE_TOKEN
|
||||||
|
required: true
|
||||||
|
ini:
|
||||||
|
- section: callback_logentries
|
||||||
|
key: token
|
||||||
|
use_tls:
|
||||||
description:
|
description:
|
||||||
- This callback plugin will generate JSON objects and send them to Logentries via TCP for auditing/debugging purposes.
|
- Toggle to decide whether to use TLS to encrypt the communications with the API server.
|
||||||
- Before 2.4, if you wanted to use an ini configuration, the file must be placed in the same directory as this plugin and named C(logentries.ini).
|
env:
|
||||||
- In 2.4 and above you can just put it in the main Ansible configuration file.
|
- name: LOGENTRIES_USE_TLS
|
||||||
requirements:
|
default: false
|
||||||
- whitelisting in configuration
|
type: boolean
|
||||||
- certifi (Python library)
|
ini:
|
||||||
- flatdict (Python library), if you want to use the O(flatten) option
|
- section: callback_logentries
|
||||||
options:
|
key: use_tls
|
||||||
api:
|
flatten:
|
||||||
description: URI to the Logentries API.
|
description: Flatten complex data structures into a single dictionary with complex keys.
|
||||||
type: str
|
type: boolean
|
||||||
env:
|
default: false
|
||||||
- name: LOGENTRIES_API
|
env:
|
||||||
default: data.logentries.com
|
- name: LOGENTRIES_FLATTEN
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logentries
|
- section: callback_logentries
|
||||||
key: api
|
key: flatten
|
||||||
port:
|
"""
|
||||||
description: HTTP port to use when connecting to the API.
|
|
||||||
type: int
|
|
||||||
env:
|
|
||||||
- name: LOGENTRIES_PORT
|
|
||||||
default: 80
|
|
||||||
ini:
|
|
||||||
- section: callback_logentries
|
|
||||||
key: port
|
|
||||||
tls_port:
|
|
||||||
description: Port to use when connecting to the API when TLS is enabled.
|
|
||||||
type: int
|
|
||||||
env:
|
|
||||||
- name: LOGENTRIES_TLS_PORT
|
|
||||||
default: 443
|
|
||||||
ini:
|
|
||||||
- section: callback_logentries
|
|
||||||
key: tls_port
|
|
||||||
token:
|
|
||||||
description: The logentries C(TCP token).
|
|
||||||
type: str
|
|
||||||
env:
|
|
||||||
- name: LOGENTRIES_ANSIBLE_TOKEN
|
|
||||||
required: true
|
|
||||||
ini:
|
|
||||||
- section: callback_logentries
|
|
||||||
key: token
|
|
||||||
use_tls:
|
|
||||||
description:
|
|
||||||
- Toggle to decide whether to use TLS to encrypt the communications with the API server.
|
|
||||||
env:
|
|
||||||
- name: LOGENTRIES_USE_TLS
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
ini:
|
|
||||||
- section: callback_logentries
|
|
||||||
key: use_tls
|
|
||||||
flatten:
|
|
||||||
description: Flatten complex data structures into a single dictionary with complex keys.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
env:
|
|
||||||
- name: LOGENTRIES_FLATTEN
|
|
||||||
ini:
|
|
||||||
- section: callback_logentries
|
|
||||||
key: flatten
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: >
|
examples: >-
|
||||||
To enable, add this to your ansible.cfg file in the defaults block
|
To enable, add this to your ansible.cfg file in the defaults block
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
|
@ -97,7 +95,7 @@ examples: >
|
||||||
use_tls = true
|
use_tls = true
|
||||||
token = dd21fc88-f00a-43ff-b977-e3a4233c53af
|
token = dd21fc88-f00a-43ff-b977-e3a4233c53af
|
||||||
flatten = false
|
flatten = false
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
|
|
@ -7,95 +7,94 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
author: Yevhen Khmelenko (@ujenmr)
|
author: Yevhen Khmelenko (@ujenmr)
|
||||||
name: logstash
|
name: logstash
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends events to Logstash
|
short_description: Sends events to Logstash
|
||||||
description:
|
description:
|
||||||
- This callback will report facts and task events to Logstash U(https://www.elastic.co/products/logstash).
|
- This callback will report facts and task events to Logstash U(https://www.elastic.co/products/logstash).
|
||||||
requirements:
|
requirements:
|
||||||
- whitelisting in configuration
|
- whitelisting in configuration
|
||||||
- logstash (Python library)
|
- logstash (Python library)
|
||||||
options:
|
options:
|
||||||
server:
|
server:
|
||||||
description: Address of the Logstash server.
|
description: Address of the Logstash server.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: LOGSTASH_SERVER
|
- name: LOGSTASH_SERVER
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logstash
|
- section: callback_logstash
|
||||||
key: server
|
key: server
|
||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
default: localhost
|
default: localhost
|
||||||
port:
|
port:
|
||||||
description: Port on which logstash is listening.
|
description: Port on which logstash is listening.
|
||||||
type: int
|
type: int
|
||||||
env:
|
env:
|
||||||
- name: LOGSTASH_PORT
|
- name: LOGSTASH_PORT
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logstash
|
- section: callback_logstash
|
||||||
key: port
|
key: port
|
||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
default: 5000
|
default: 5000
|
||||||
type:
|
type:
|
||||||
description: Message type.
|
description: Message type.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: LOGSTASH_TYPE
|
- name: LOGSTASH_TYPE
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logstash
|
- section: callback_logstash
|
||||||
key: type
|
key: type
|
||||||
version_added: 1.0.0
|
version_added: 1.0.0
|
||||||
default: ansible
|
default: ansible
|
||||||
pre_command:
|
pre_command:
|
||||||
description: Executes command before run and its result is added to the C(ansible_pre_command_output) logstash field.
|
description: Executes command before run and its result is added to the C(ansible_pre_command_output) logstash field.
|
||||||
type: str
|
type: str
|
||||||
version_added: 2.0.0
|
version_added: 2.0.0
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logstash
|
- section: callback_logstash
|
||||||
key: pre_command
|
key: pre_command
|
||||||
env:
|
env:
|
||||||
- name: LOGSTASH_PRE_COMMAND
|
- name: LOGSTASH_PRE_COMMAND
|
||||||
format_version:
|
format_version:
|
||||||
description: Logging format.
|
description: Logging format.
|
||||||
type: str
|
type: str
|
||||||
version_added: 2.0.0
|
version_added: 2.0.0
|
||||||
ini:
|
ini:
|
||||||
- section: callback_logstash
|
- section: callback_logstash
|
||||||
key: format_version
|
key: format_version
|
||||||
env:
|
env:
|
||||||
- name: LOGSTASH_FORMAT_VERSION
|
- name: LOGSTASH_FORMAT_VERSION
|
||||||
default: v1
|
default: v1
|
||||||
choices:
|
choices:
|
||||||
- v1
|
- v1
|
||||||
- v2
|
- v2
|
||||||
|
"""
|
||||||
|
|
||||||
'''
|
EXAMPLES = r"""
|
||||||
|
|
||||||
EXAMPLES = r'''
|
|
||||||
ansible.cfg: |
|
ansible.cfg: |
|
||||||
# Enable Callback plugin
|
# Enable Callback plugin
|
||||||
[defaults]
|
[defaults]
|
||||||
callback_whitelist = community.general.logstash
|
callback_whitelist = community.general.logstash
|
||||||
|
|
||||||
[callback_logstash]
|
[callback_logstash]
|
||||||
server = logstash.example.com
|
server = logstash.example.com
|
||||||
port = 5000
|
port = 5000
|
||||||
pre_command = git rev-parse HEAD
|
pre_command = git rev-parse HEAD
|
||||||
type = ansible
|
type = ansible
|
||||||
|
|
||||||
11-input-tcp.conf: |
|
11-input-tcp.conf: |-
|
||||||
# Enable Logstash TCP Input
|
# Enable Logstash TCP Input
|
||||||
input {
|
input {
|
||||||
tcp {
|
tcp {
|
||||||
port => 5000
|
port => 5000
|
||||||
codec => json
|
codec => json
|
||||||
add_field => { "[@metadata][beat]" => "notify" }
|
add_field => { "[@metadata][beat]" => "notify" }
|
||||||
add_field => { "[@metadata][type]" => "ansible" }
|
add_field => { "[@metadata][type]" => "ansible" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -7,81 +7,80 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: mail
|
name: mail
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends failure events via email
|
short_description: Sends failure events through email
|
||||||
description:
|
description:
|
||||||
- This callback will report failures via email.
|
- This callback will report failures through email.
|
||||||
author:
|
author:
|
||||||
- Dag Wieers (@dagwieers)
|
- Dag Wieers (@dagwieers)
|
||||||
requirements:
|
requirements:
|
||||||
- whitelisting in configuration
|
- whitelisting in configuration
|
||||||
options:
|
options:
|
||||||
mta:
|
mta:
|
||||||
description:
|
description:
|
||||||
- Mail Transfer Agent, server that accepts SMTP.
|
- Mail Transfer Agent, server that accepts SMTP.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SMTPHOST
|
- name: SMTPHOST
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: smtphost
|
key: smtphost
|
||||||
default: localhost
|
default: localhost
|
||||||
mtaport:
|
mtaport:
|
||||||
description:
|
description:
|
||||||
- Mail Transfer Agent Port.
|
- Mail Transfer Agent Port.
|
||||||
- Port at which server SMTP.
|
- Port at which server SMTP.
|
||||||
type: int
|
type: int
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: smtpport
|
key: smtpport
|
||||||
default: 25
|
default: 25
|
||||||
to:
|
to:
|
||||||
description:
|
description:
|
||||||
- Mail recipient.
|
- Mail recipient.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: to
|
key: to
|
||||||
default: [root]
|
default: [root]
|
||||||
sender:
|
sender:
|
||||||
description:
|
description:
|
||||||
- Mail sender.
|
- Mail sender.
|
||||||
- This is required since community.general 6.0.0.
|
- This is required since community.general 6.0.0.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: sender
|
key: sender
|
||||||
cc:
|
cc:
|
||||||
description:
|
description:
|
||||||
- CC'd recipients.
|
- CC'd recipients.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: cc
|
key: cc
|
||||||
bcc:
|
bcc:
|
||||||
description:
|
description:
|
||||||
- BCC'd recipients.
|
- BCC'd recipients.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: bcc
|
key: bcc
|
||||||
message_id_domain:
|
message_id_domain:
|
||||||
description:
|
description:
|
||||||
- The domain name to use for the L(Message-ID header, https://en.wikipedia.org/wiki/Message-ID).
|
- The domain name to use for the L(Message-ID header, https://en.wikipedia.org/wiki/Message-ID).
|
||||||
- The default is the hostname of the control node.
|
- The default is the hostname of the control node.
|
||||||
type: str
|
type: str
|
||||||
ini:
|
ini:
|
||||||
- section: callback_mail
|
- section: callback_mail
|
||||||
key: message_id_domain
|
key: message_id_domain
|
||||||
version_added: 8.2.0
|
version_added: 8.2.0
|
||||||
|
"""
|
||||||
'''
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -7,65 +7,65 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: nrdp
|
name: nrdp
|
||||||
type: notification
|
type: notification
|
||||||
author: "Remi VERCHERE (@rverchere)"
|
author: "Remi VERCHERE (@rverchere)"
|
||||||
short_description: Post task results to a Nagios server through nrdp
|
short_description: Post task results to a Nagios server through nrdp
|
||||||
description:
|
description:
|
||||||
- This callback send playbook result to Nagios.
|
- This callback send playbook result to Nagios.
|
||||||
- Nagios shall use NRDP to receive passive events.
|
- Nagios shall use NRDP to receive passive events.
|
||||||
- The passive check is sent to a dedicated host/service for Ansible.
|
- The passive check is sent to a dedicated host/service for Ansible.
|
||||||
options:
|
options:
|
||||||
url:
|
url:
|
||||||
description: URL of the nrdp server.
|
description: URL of the nrdp server.
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name : NRDP_URL
|
- name: NRDP_URL
|
||||||
ini:
|
ini:
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: url
|
key: url
|
||||||
type: string
|
type: string
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description: Validate the SSL certificate of the nrdp server. (Used for HTTPS URLs.)
|
description: Validate the SSL certificate of the nrdp server. (Used for HTTPS URLs).
|
||||||
env:
|
env:
|
||||||
- name: NRDP_VALIDATE_CERTS
|
- name: NRDP_VALIDATE_CERTS
|
||||||
ini:
|
ini:
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: validate_nrdp_certs
|
key: validate_nrdp_certs
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: validate_certs
|
key: validate_certs
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
aliases: [ validate_nrdp_certs ]
|
aliases: [validate_nrdp_certs]
|
||||||
token:
|
token:
|
||||||
description: Token to be allowed to push nrdp events.
|
description: Token to be allowed to push nrdp events.
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name: NRDP_TOKEN
|
- name: NRDP_TOKEN
|
||||||
ini:
|
ini:
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: token
|
key: token
|
||||||
type: string
|
type: string
|
||||||
hostname:
|
hostname:
|
||||||
description: Hostname where the passive check is linked to.
|
description: Hostname where the passive check is linked to.
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name : NRDP_HOSTNAME
|
- name: NRDP_HOSTNAME
|
||||||
ini:
|
ini:
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: hostname
|
key: hostname
|
||||||
type: string
|
type: string
|
||||||
servicename:
|
servicename:
|
||||||
description: Service where the passive check is linked to.
|
description: Service where the passive check is linked to.
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
- name : NRDP_SERVICENAME
|
- name: NRDP_SERVICENAME
|
||||||
ini:
|
ini:
|
||||||
- section: callback_nrdp
|
- section: callback_nrdp
|
||||||
key: servicename
|
key: servicename
|
||||||
type: string
|
type: string
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
from ansible.module_utils.six.moves.urllib.parse import urlencode
|
||||||
from ansible.module_utils.common.text.converters import to_bytes
|
from ansible.module_utils.common.text.converters import to_bytes
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: 'null'
|
name: 'null'
|
||||||
type: stdout
|
type: stdout
|
||||||
requirements:
|
requirements:
|
||||||
- set as main display callback
|
- set as main display callback
|
||||||
short_description: Don't display stuff to screen
|
short_description: do not display stuff to screen
|
||||||
description:
|
description:
|
||||||
- This callback prevents outputting events to screen.
|
- This callback prevents outputting events to screen.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
|
|
||||||
|
|
|
@ -6,119 +6,120 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Victor Martinez (@v1v) <VictorMartinezRubio@gmail.com>
|
author: Victor Martinez (@v1v) <VictorMartinezRubio@gmail.com>
|
||||||
name: opentelemetry
|
name: opentelemetry
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Create distributed traces with OpenTelemetry
|
short_description: Create distributed traces with OpenTelemetry
|
||||||
version_added: 3.7.0
|
version_added: 3.7.0
|
||||||
|
description:
|
||||||
|
- This callback creates distributed traces for each Ansible task with OpenTelemetry.
|
||||||
|
- You can configure the OpenTelemetry exporter and SDK with environment variables.
|
||||||
|
- See U(https://opentelemetry-python.readthedocs.io/en/latest/exporter/otlp/otlp.html).
|
||||||
|
- See
|
||||||
|
U(https://opentelemetry-python.readthedocs.io/en/latest/sdk/environment_variables.html#opentelemetry-sdk-environment-variables).
|
||||||
|
options:
|
||||||
|
hide_task_arguments:
|
||||||
|
default: false
|
||||||
|
type: bool
|
||||||
description:
|
description:
|
||||||
- This callback creates distributed traces for each Ansible task with OpenTelemetry.
|
- Hide the arguments for a task.
|
||||||
- You can configure the OpenTelemetry exporter and SDK with environment variables.
|
env:
|
||||||
- See U(https://opentelemetry-python.readthedocs.io/en/latest/exporter/otlp/otlp.html).
|
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
||||||
- See U(https://opentelemetry-python.readthedocs.io/en/latest/sdk/environment_variables.html#opentelemetry-sdk-environment-variables).
|
ini:
|
||||||
options:
|
- section: callback_opentelemetry
|
||||||
hide_task_arguments:
|
key: hide_task_arguments
|
||||||
default: false
|
version_added: 5.3.0
|
||||||
type: bool
|
enable_from_environment:
|
||||||
description:
|
type: str
|
||||||
- Hide the arguments for a task.
|
description:
|
||||||
env:
|
- Whether to enable this callback only if the given environment variable exists and it is set to V(true).
|
||||||
- name: ANSIBLE_OPENTELEMETRY_HIDE_TASK_ARGUMENTS
|
- This is handy when you use Configuration as Code and want to send distributed traces if running in the CI rather when
|
||||||
ini:
|
running Ansible locally.
|
||||||
- section: callback_opentelemetry
|
- For such, it evaluates the given O(enable_from_environment) value as environment variable and if set to true this
|
||||||
key: hide_task_arguments
|
plugin will be enabled.
|
||||||
version_added: 5.3.0
|
env:
|
||||||
enable_from_environment:
|
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
||||||
type: str
|
ini:
|
||||||
description:
|
- section: callback_opentelemetry
|
||||||
- Whether to enable this callback only if the given environment variable exists and it is set to V(true).
|
key: enable_from_environment
|
||||||
- This is handy when you use Configuration as Code and want to send distributed traces
|
version_added: 5.3.0
|
||||||
if running in the CI rather when running Ansible locally.
|
version_added: 3.8.0
|
||||||
- For such, it evaluates the given O(enable_from_environment) value as environment variable
|
otel_service_name:
|
||||||
and if set to true this plugin will be enabled.
|
default: ansible
|
||||||
env:
|
type: str
|
||||||
- name: ANSIBLE_OPENTELEMETRY_ENABLE_FROM_ENVIRONMENT
|
description:
|
||||||
ini:
|
- The service name resource attribute.
|
||||||
- section: callback_opentelemetry
|
env:
|
||||||
key: enable_from_environment
|
- name: OTEL_SERVICE_NAME
|
||||||
version_added: 5.3.0
|
ini:
|
||||||
version_added: 3.8.0
|
- section: callback_opentelemetry
|
||||||
otel_service_name:
|
key: otel_service_name
|
||||||
default: ansible
|
version_added: 5.3.0
|
||||||
type: str
|
traceparent:
|
||||||
description:
|
default: None
|
||||||
- The service name resource attribute.
|
type: str
|
||||||
env:
|
description:
|
||||||
- name: OTEL_SERVICE_NAME
|
- The L(W3C Trace Context header traceparent,https://www.w3.org/TR/trace-context-1/#traceparent-header).
|
||||||
ini:
|
env:
|
||||||
- section: callback_opentelemetry
|
- name: TRACEPARENT
|
||||||
key: otel_service_name
|
disable_logs:
|
||||||
version_added: 5.3.0
|
default: false
|
||||||
traceparent:
|
type: bool
|
||||||
default: None
|
description:
|
||||||
type: str
|
- Disable sending logs.
|
||||||
description:
|
env:
|
||||||
- The L(W3C Trace Context header traceparent,https://www.w3.org/TR/trace-context-1/#traceparent-header).
|
- name: ANSIBLE_OPENTELEMETRY_DISABLE_LOGS
|
||||||
env:
|
ini:
|
||||||
- name: TRACEPARENT
|
- section: callback_opentelemetry
|
||||||
disable_logs:
|
key: disable_logs
|
||||||
default: false
|
version_added: 5.8.0
|
||||||
type: bool
|
disable_attributes_in_logs:
|
||||||
description:
|
default: false
|
||||||
- Disable sending logs.
|
type: bool
|
||||||
env:
|
description:
|
||||||
- name: ANSIBLE_OPENTELEMETRY_DISABLE_LOGS
|
- Disable populating span attributes to the logs.
|
||||||
ini:
|
env:
|
||||||
- section: callback_opentelemetry
|
- name: ANSIBLE_OPENTELEMETRY_DISABLE_ATTRIBUTES_IN_LOGS
|
||||||
key: disable_logs
|
ini:
|
||||||
version_added: 5.8.0
|
- section: callback_opentelemetry
|
||||||
disable_attributes_in_logs:
|
key: disable_attributes_in_logs
|
||||||
default: false
|
version_added: 7.1.0
|
||||||
type: bool
|
store_spans_in_file:
|
||||||
description:
|
type: str
|
||||||
- Disable populating span attributes to the logs.
|
description:
|
||||||
env:
|
- It stores the exported spans in the given file.
|
||||||
- name: ANSIBLE_OPENTELEMETRY_DISABLE_ATTRIBUTES_IN_LOGS
|
env:
|
||||||
ini:
|
- name: ANSIBLE_OPENTELEMETRY_STORE_SPANS_IN_FILE
|
||||||
- section: callback_opentelemetry
|
ini:
|
||||||
key: disable_attributes_in_logs
|
- section: callback_opentelemetry
|
||||||
version_added: 7.1.0
|
key: store_spans_in_file
|
||||||
store_spans_in_file:
|
version_added: 9.0.0
|
||||||
type: str
|
otel_exporter_otlp_traces_protocol:
|
||||||
description:
|
type: str
|
||||||
- It stores the exported spans in the given file
|
description:
|
||||||
env:
|
- E(OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) represents the the transport protocol for spans.
|
||||||
- name: ANSIBLE_OPENTELEMETRY_STORE_SPANS_IN_FILE
|
- See
|
||||||
ini:
|
U(https://opentelemetry-python.readthedocs.io/en/latest/sdk/environment_variables.html#envvar-OTEL_EXPORTER_OTLP_TRACES_PROTOCOL).
|
||||||
- section: callback_opentelemetry
|
default: grpc
|
||||||
key: store_spans_in_file
|
choices:
|
||||||
version_added: 9.0.0
|
- grpc
|
||||||
otel_exporter_otlp_traces_protocol:
|
- http/protobuf
|
||||||
type: str
|
env:
|
||||||
description:
|
- name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
|
||||||
- E(OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) represents the the transport protocol for spans.
|
ini:
|
||||||
- See
|
- section: callback_opentelemetry
|
||||||
U(https://opentelemetry-python.readthedocs.io/en/latest/sdk/environment_variables.html#envvar-OTEL_EXPORTER_OTLP_TRACES_PROTOCOL).
|
key: otel_exporter_otlp_traces_protocol
|
||||||
default: grpc
|
version_added: 9.0.0
|
||||||
choices:
|
requirements:
|
||||||
- grpc
|
- opentelemetry-api (Python library)
|
||||||
- http/protobuf
|
- opentelemetry-exporter-otlp (Python library)
|
||||||
env:
|
- opentelemetry-sdk (Python library)
|
||||||
- name: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
|
"""
|
||||||
ini:
|
|
||||||
- section: callback_opentelemetry
|
|
||||||
key: otel_exporter_otlp_traces_protocol
|
|
||||||
version_added: 9.0.0
|
|
||||||
requirements:
|
|
||||||
- opentelemetry-api (Python library)
|
|
||||||
- opentelemetry-exporter-otlp (Python library)
|
|
||||||
- opentelemetry-sdk (Python library)
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: |
|
examples: |-
|
||||||
Enable the plugin in ansible.cfg:
|
Enable the plugin in ansible.cfg:
|
||||||
[defaults]
|
[defaults]
|
||||||
callbacks_enabled = community.general.opentelemetry
|
callbacks_enabled = community.general.opentelemetry
|
||||||
|
@ -130,7 +131,7 @@ examples: |
|
||||||
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token"
|
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer your_otel_token"
|
||||||
export OTEL_SERVICE_NAME=your_service_name
|
export OTEL_SERVICE_NAME=your_service_name
|
||||||
export ANSIBLE_OPENTELEMETRY_ENABLED=true
|
export ANSIBLE_OPENTELEMETRY_ENABLED=true
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -8,17 +8,17 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: say
|
name: say
|
||||||
type: notification
|
type: notification
|
||||||
requirements:
|
requirements:
|
||||||
- whitelisting in configuration
|
- whitelisting in configuration
|
||||||
- the C(/usr/bin/say) command line program (standard on macOS) or C(espeak) command line program
|
- the C(/usr/bin/say) command line program (standard on macOS) or C(espeak) command line program
|
||||||
short_description: notify using software speech synthesizer
|
short_description: notify using software speech synthesizer
|
||||||
description:
|
description:
|
||||||
- This plugin will use the C(say) or C(espeak) program to "speak" about play events.
|
- This plugin will use the C(say) or C(espeak) program to "speak" about play events.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -7,35 +7,35 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: selective
|
name: selective
|
||||||
type: stdout
|
type: stdout
|
||||||
requirements:
|
requirements:
|
||||||
- set as main display callback
|
- set as main display callback
|
||||||
short_description: only print certain tasks
|
short_description: only print certain tasks
|
||||||
description:
|
description:
|
||||||
- This callback only prints tasks that have been tagged with C(print_action) or that have failed.
|
- This callback only prints tasks that have been tagged with C(print_action) or that have failed. This allows operators
|
||||||
This allows operators to focus on the tasks that provide value only.
|
to focus on the tasks that provide value only.
|
||||||
- Tasks that are not printed are placed with a C(.).
|
- Tasks that are not printed are placed with a C(.).
|
||||||
- If you increase verbosity all tasks are printed.
|
- If you increase verbosity all tasks are printed.
|
||||||
options:
|
options:
|
||||||
nocolor:
|
nocolor:
|
||||||
default: false
|
default: false
|
||||||
description: This setting allows suppressing colorizing output.
|
description: This setting allows suppressing colorizing output.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_NOCOLOR
|
- name: ANSIBLE_NOCOLOR
|
||||||
- name: ANSIBLE_SELECTIVE_DONT_COLORIZE
|
- name: ANSIBLE_SELECTIVE_DONT_COLORIZE
|
||||||
ini:
|
ini:
|
||||||
- section: defaults
|
- section: defaults
|
||||||
key: nocolor
|
key: nocolor
|
||||||
type: boolean
|
type: boolean
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = r"""
|
||||||
- ansible.builtin.debug: msg="This will not be printed"
|
- ansible.builtin.debug: msg="This will not be printed"
|
||||||
- ansible.builtin.debug: msg="But this will"
|
- ansible.builtin.debug: msg="But this will"
|
||||||
tags: [print_action]
|
tags: [print_action]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
|
|
|
@ -8,54 +8,54 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: slack
|
name: slack
|
||||||
type: notification
|
type: notification
|
||||||
requirements:
|
requirements:
|
||||||
- whitelist in configuration
|
- whitelist in configuration
|
||||||
- prettytable (python library)
|
- prettytable (python library)
|
||||||
short_description: Sends play events to a Slack channel
|
short_description: Sends play events to a Slack channel
|
||||||
description:
|
description:
|
||||||
- This is an ansible callback plugin that sends status updates to a Slack channel during playbook execution.
|
- This is an ansible callback plugin that sends status updates to a Slack channel during playbook execution.
|
||||||
options:
|
options:
|
||||||
webhook_url:
|
webhook_url:
|
||||||
required: true
|
required: true
|
||||||
description: Slack Webhook URL.
|
description: Slack Webhook URL.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SLACK_WEBHOOK_URL
|
- name: SLACK_WEBHOOK_URL
|
||||||
ini:
|
ini:
|
||||||
- section: callback_slack
|
- section: callback_slack
|
||||||
key: webhook_url
|
key: webhook_url
|
||||||
channel:
|
channel:
|
||||||
default: "#ansible"
|
default: "#ansible"
|
||||||
description: Slack room to post in.
|
description: Slack room to post in.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SLACK_CHANNEL
|
- name: SLACK_CHANNEL
|
||||||
ini:
|
ini:
|
||||||
- section: callback_slack
|
- section: callback_slack
|
||||||
key: channel
|
key: channel
|
||||||
username:
|
username:
|
||||||
description: Username to post as.
|
description: Username to post as.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SLACK_USERNAME
|
- name: SLACK_USERNAME
|
||||||
default: ansible
|
default: ansible
|
||||||
ini:
|
ini:
|
||||||
- section: callback_slack
|
- section: callback_slack
|
||||||
key: username
|
key: username
|
||||||
validate_certs:
|
validate_certs:
|
||||||
description: Validate the SSL certificate of the Slack server for HTTPS URLs.
|
description: Validate the SSL certificate of the Slack server for HTTPS URLs.
|
||||||
env:
|
env:
|
||||||
- name: SLACK_VALIDATE_CERTS
|
- name: SLACK_VALIDATE_CERTS
|
||||||
ini:
|
ini:
|
||||||
- section: callback_slack
|
- section: callback_slack
|
||||||
key: validate_certs
|
key: validate_certs
|
||||||
default: true
|
default: true
|
||||||
type: bool
|
type: bool
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -6,73 +6,73 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: splunk
|
name: splunk
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends task result events to Splunk HTTP Event Collector
|
short_description: Sends task result events to Splunk HTTP Event Collector
|
||||||
author: "Stuart Hirst (!UNKNOWN) <support@convergingdata.com>"
|
author: "Stuart Hirst (!UNKNOWN) <support@convergingdata.com>"
|
||||||
|
description:
|
||||||
|
- This callback plugin will send task results as JSON formatted events to a Splunk HTTP collector.
|
||||||
|
- The companion Splunk Monitoring & Diagnostics App is available here U(https://splunkbase.splunk.com/app/4023/).
|
||||||
|
- Credit to "Ryan Currah (@ryancurrah)" for original source upon which this is based.
|
||||||
|
requirements:
|
||||||
|
- Whitelisting this callback plugin
|
||||||
|
- 'Create a HTTP Event Collector in Splunk'
|
||||||
|
- 'Define the URL and token in C(ansible.cfg)'
|
||||||
|
options:
|
||||||
|
url:
|
||||||
|
description: URL to the Splunk HTTP collector source.
|
||||||
|
type: str
|
||||||
|
env:
|
||||||
|
- name: SPLUNK_URL
|
||||||
|
ini:
|
||||||
|
- section: callback_splunk
|
||||||
|
key: url
|
||||||
|
authtoken:
|
||||||
|
description: Token to authenticate the connection to the Splunk HTTP collector.
|
||||||
|
type: str
|
||||||
|
env:
|
||||||
|
- name: SPLUNK_AUTHTOKEN
|
||||||
|
ini:
|
||||||
|
- section: callback_splunk
|
||||||
|
key: authtoken
|
||||||
|
validate_certs:
|
||||||
|
description: Whether to validate certificates for connections to HEC. It is not recommended to set to V(false) except
|
||||||
|
when you are sure that nobody can intercept the connection between this plugin and HEC, as setting it to V(false) allows
|
||||||
|
man-in-the-middle attacks!
|
||||||
|
env:
|
||||||
|
- name: SPLUNK_VALIDATE_CERTS
|
||||||
|
ini:
|
||||||
|
- section: callback_splunk
|
||||||
|
key: validate_certs
|
||||||
|
type: bool
|
||||||
|
default: true
|
||||||
|
version_added: '1.0.0'
|
||||||
|
include_milliseconds:
|
||||||
|
description: Whether to include milliseconds as part of the generated timestamp field in the event sent to the Splunk
|
||||||
|
HTTP collector.
|
||||||
|
env:
|
||||||
|
- name: SPLUNK_INCLUDE_MILLISECONDS
|
||||||
|
ini:
|
||||||
|
- section: callback_splunk
|
||||||
|
key: include_milliseconds
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 2.0.0
|
||||||
|
batch:
|
||||||
description:
|
description:
|
||||||
- This callback plugin will send task results as JSON formatted events to a Splunk HTTP collector.
|
- Correlation ID which can be set across multiple playbook executions.
|
||||||
- The companion Splunk Monitoring & Diagnostics App is available here U(https://splunkbase.splunk.com/app/4023/).
|
env:
|
||||||
- Credit to "Ryan Currah (@ryancurrah)" for original source upon which this is based.
|
- name: SPLUNK_BATCH
|
||||||
requirements:
|
ini:
|
||||||
- Whitelisting this callback plugin
|
- section: callback_splunk
|
||||||
- 'Create a HTTP Event Collector in Splunk'
|
key: batch
|
||||||
- 'Define the URL and token in C(ansible.cfg)'
|
type: str
|
||||||
options:
|
version_added: 3.3.0
|
||||||
url:
|
"""
|
||||||
description: URL to the Splunk HTTP collector source.
|
|
||||||
type: str
|
|
||||||
env:
|
|
||||||
- name: SPLUNK_URL
|
|
||||||
ini:
|
|
||||||
- section: callback_splunk
|
|
||||||
key: url
|
|
||||||
authtoken:
|
|
||||||
description: Token to authenticate the connection to the Splunk HTTP collector.
|
|
||||||
type: str
|
|
||||||
env:
|
|
||||||
- name: SPLUNK_AUTHTOKEN
|
|
||||||
ini:
|
|
||||||
- section: callback_splunk
|
|
||||||
key: authtoken
|
|
||||||
validate_certs:
|
|
||||||
description: Whether to validate certificates for connections to HEC. It is not recommended to set to
|
|
||||||
V(false) except when you are sure that nobody can intercept the connection
|
|
||||||
between this plugin and HEC, as setting it to V(false) allows man-in-the-middle attacks!
|
|
||||||
env:
|
|
||||||
- name: SPLUNK_VALIDATE_CERTS
|
|
||||||
ini:
|
|
||||||
- section: callback_splunk
|
|
||||||
key: validate_certs
|
|
||||||
type: bool
|
|
||||||
default: true
|
|
||||||
version_added: '1.0.0'
|
|
||||||
include_milliseconds:
|
|
||||||
description: Whether to include milliseconds as part of the generated timestamp field in the event
|
|
||||||
sent to the Splunk HTTP collector.
|
|
||||||
env:
|
|
||||||
- name: SPLUNK_INCLUDE_MILLISECONDS
|
|
||||||
ini:
|
|
||||||
- section: callback_splunk
|
|
||||||
key: include_milliseconds
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
version_added: 2.0.0
|
|
||||||
batch:
|
|
||||||
description:
|
|
||||||
- Correlation ID which can be set across multiple playbook executions.
|
|
||||||
env:
|
|
||||||
- name: SPLUNK_BATCH
|
|
||||||
ini:
|
|
||||||
- section: callback_splunk
|
|
||||||
key: batch
|
|
||||||
type: str
|
|
||||||
version_added: 3.3.0
|
|
||||||
'''
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: >
|
examples: >-
|
||||||
To enable, add this to your ansible.cfg file in the defaults block
|
To enable, add this to your ansible.cfg file in the defaults block
|
||||||
[defaults]
|
[defaults]
|
||||||
callback_whitelist = community.general.splunk
|
callback_whitelist = community.general.splunk
|
||||||
|
@ -83,7 +83,7 @@ examples: >
|
||||||
[callback_splunk]
|
[callback_splunk]
|
||||||
url = http://mysplunkinstance.datapaas.io:8088/services/collector/event
|
url = http://mysplunkinstance.datapaas.io:8088/services/collector/event
|
||||||
authtoken = f23blad6-5965-4537-bf69-5b5a545blabla88
|
authtoken = f23blad6-5965-4537-bf69-5b5a545blabla88
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r"""
|
||||||
name: sumologic
|
name: sumologic
|
||||||
type: notification
|
type: notification
|
||||||
short_description: Sends task result events to Sumologic
|
short_description: Sends task result events to Sumologic
|
||||||
|
@ -15,8 +15,8 @@ description:
|
||||||
- This callback plugin will send task results as JSON formatted events to a Sumologic HTTP collector source.
|
- This callback plugin will send task results as JSON formatted events to a Sumologic HTTP collector source.
|
||||||
requirements:
|
requirements:
|
||||||
- Whitelisting this callback plugin
|
- Whitelisting this callback plugin
|
||||||
- 'Create a HTTP collector source in Sumologic and specify a custom timestamp format of V(yyyy-MM-dd HH:mm:ss ZZZZ) and a custom timestamp locator
|
- 'Create a HTTP collector source in Sumologic and specify a custom timestamp format of V(yyyy-MM-dd HH:mm:ss ZZZZ) and
|
||||||
of V("timestamp": "(.*\)")'
|
a custom timestamp locator of V("timestamp": "(.*\)")'
|
||||||
options:
|
options:
|
||||||
url:
|
url:
|
||||||
description: URL to the Sumologic HTTP collector source.
|
description: URL to the Sumologic HTTP collector source.
|
||||||
|
@ -26,10 +26,10 @@ options:
|
||||||
ini:
|
ini:
|
||||||
- section: callback_sumologic
|
- section: callback_sumologic
|
||||||
key: url
|
key: url
|
||||||
'''
|
"""
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r"""
|
||||||
examples: |
|
examples: |-
|
||||||
To enable, add this to your ansible.cfg file in the defaults block
|
To enable, add this to your ansible.cfg file in the defaults block
|
||||||
[defaults]
|
[defaults]
|
||||||
callback_whitelist = community.general.sumologic
|
callback_whitelist = community.general.sumologic
|
||||||
|
@ -40,7 +40,7 @@ examples: |
|
||||||
Set the ansible.cfg variable in the callback_sumologic block
|
Set the ansible.cfg variable in the callback_sumologic block
|
||||||
[callback_sumologic]
|
[callback_sumologic]
|
||||||
url = https://endpoint1.collection.us2.sumologic.com/receiver/v1/http/R8moSv1d8EW9LAUFZJ6dbxCFxwLH6kfCdcBfddlfxCbLuL-BN5twcTpMk__pYy_cDmp==
|
url = https://endpoint1.collection.us2.sumologic.com/receiver/v1/http/R8moSv1d8EW9LAUFZJ6dbxCFxwLH6kfCdcBfddlfxCbLuL-BN5twcTpMk__pYy_cDmp==
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
|
@ -7,54 +7,54 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: syslog_json
|
name: syslog_json
|
||||||
type: notification
|
type: notification
|
||||||
requirements:
|
requirements:
|
||||||
- whitelist in configuration
|
- whitelist in configuration
|
||||||
short_description: sends JSON events to syslog
|
short_description: sends JSON events to syslog
|
||||||
description:
|
description:
|
||||||
- This plugin logs ansible-playbook and ansible runs to a syslog server in JSON format.
|
- This plugin logs ansible-playbook and ansible runs to a syslog server in JSON format.
|
||||||
options:
|
options:
|
||||||
server:
|
server:
|
||||||
description: Syslog server that will receive the event.
|
description: Syslog server that will receive the event.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SYSLOG_SERVER
|
- name: SYSLOG_SERVER
|
||||||
default: localhost
|
default: localhost
|
||||||
ini:
|
ini:
|
||||||
- section: callback_syslog_json
|
- section: callback_syslog_json
|
||||||
key: syslog_server
|
key: syslog_server
|
||||||
port:
|
port:
|
||||||
description: Port on which the syslog server is listening.
|
description: Port on which the syslog server is listening.
|
||||||
type: int
|
type: int
|
||||||
env:
|
env:
|
||||||
- name: SYSLOG_PORT
|
- name: SYSLOG_PORT
|
||||||
default: 514
|
default: 514
|
||||||
ini:
|
ini:
|
||||||
- section: callback_syslog_json
|
- section: callback_syslog_json
|
||||||
key: syslog_port
|
key: syslog_port
|
||||||
facility:
|
facility:
|
||||||
description: Syslog facility to log as.
|
description: Syslog facility to log as.
|
||||||
type: str
|
type: str
|
||||||
env:
|
env:
|
||||||
- name: SYSLOG_FACILITY
|
- name: SYSLOG_FACILITY
|
||||||
default: user
|
default: user
|
||||||
ini:
|
ini:
|
||||||
- section: callback_syslog_json
|
- section: callback_syslog_json
|
||||||
key: syslog_facility
|
key: syslog_facility
|
||||||
setup:
|
setup:
|
||||||
description: Log setup tasks.
|
description: Log setup tasks.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_SYSLOG_SETUP
|
- name: ANSIBLE_SYSLOG_SETUP
|
||||||
type: bool
|
type: bool
|
||||||
default: true
|
default: true
|
||||||
ini:
|
ini:
|
||||||
- section: callback_syslog_json
|
- section: callback_syslog_json
|
||||||
key: syslog_setup
|
key: syslog_setup
|
||||||
version_added: 4.5.0
|
version_added: 4.5.0
|
||||||
'''
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
|
@ -10,46 +10,45 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = r"""
|
DOCUMENTATION = r"""
|
||||||
name: timestamp
|
name: timestamp
|
||||||
type: stdout
|
type: stdout
|
||||||
short_description: Adds simple timestamp for each header
|
short_description: Adds simple timestamp for each header
|
||||||
version_added: 9.0.0
|
version_added: 9.0.0
|
||||||
description:
|
description:
|
||||||
- This callback adds simple timestamp for each header.
|
- This callback adds simple timestamp for each header.
|
||||||
author: kurokobo (@kurokobo)
|
author: kurokobo (@kurokobo)
|
||||||
options:
|
options:
|
||||||
timezone:
|
timezone:
|
||||||
description:
|
description:
|
||||||
- Timezone to use for the timestamp in IANA time zone format.
|
- Timezone to use for the timestamp in IANA time zone format.
|
||||||
- For example C(America/New_York), C(Asia/Tokyo)). Ignored on Python < 3.9.
|
- For example V(America/New_York), V(Asia/Tokyo)). Ignored on Python < 3.9.
|
||||||
ini:
|
ini:
|
||||||
- section: callback_timestamp
|
- section: callback_timestamp
|
||||||
key: timezone
|
key: timezone
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_CALLBACK_TIMESTAMP_TIMEZONE
|
- name: ANSIBLE_CALLBACK_TIMESTAMP_TIMEZONE
|
||||||
type: string
|
type: string
|
||||||
format_string:
|
format_string:
|
||||||
description:
|
description:
|
||||||
- Format of the timestamp shown to user in 1989 C standard format.
|
- Format of the timestamp shown to user in 1989 C standard format.
|
||||||
- >
|
- Refer to L(the Python documentation,https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes)
|
||||||
Refer to L(the Python documentation,https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes)
|
for the available format codes.
|
||||||
for the available format codes.
|
ini:
|
||||||
ini:
|
- section: callback_timestamp
|
||||||
- section: callback_timestamp
|
key: format_string
|
||||||
key: format_string
|
env:
|
||||||
env:
|
- name: ANSIBLE_CALLBACK_TIMESTAMP_FORMAT_STRING
|
||||||
- name: ANSIBLE_CALLBACK_TIMESTAMP_FORMAT_STRING
|
default: "%H:%M:%S"
|
||||||
default: "%H:%M:%S"
|
type: string
|
||||||
type: string
|
seealso:
|
||||||
seealso:
|
- plugin: ansible.posix.profile_tasks
|
||||||
- plugin: ansible.posix.profile_tasks
|
plugin_type: callback
|
||||||
plugin_type: callback
|
description: >-
|
||||||
description: >
|
You can use P(ansible.posix.profile_tasks#callback) callback plugin to time individual tasks and overall execution time
|
||||||
You can use P(ansible.posix.profile_tasks#callback) callback plugin to time individual tasks and overall execution time
|
with detailed timestamps.
|
||||||
with detailed timestamps.
|
extends_documentation_fragment:
|
||||||
extends_documentation_fragment:
|
- ansible.builtin.default_callback
|
||||||
- ansible.builtin.default_callback
|
- ansible.builtin.result_format_callback
|
||||||
- ansible.builtin.result_format_callback
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,18 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
name: unixy
|
name: unixy
|
||||||
type: stdout
|
type: stdout
|
||||||
author: Al Bowles (@akatch)
|
author: Al Bowles (@akatch)
|
||||||
short_description: condensed Ansible output
|
short_description: condensed Ansible output
|
||||||
description:
|
description:
|
||||||
- Consolidated Ansible output in the style of LINUX/UNIX startup logs.
|
- Consolidated Ansible output in the style of LINUX/UNIX startup logs.
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- default_callback
|
- default_callback
|
||||||
requirements:
|
requirements:
|
||||||
- set as stdout in configuration
|
- set as stdout in configuration
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
|
|
|
@ -7,29 +7,27 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = r"""
|
||||||
author: Unknown (!UNKNOWN)
|
author: Unknown (!UNKNOWN)
|
||||||
name: yaml
|
name: yaml
|
||||||
type: stdout
|
type: stdout
|
||||||
short_description: YAML-ized Ansible screen output
|
short_description: YAML-ized Ansible screen output
|
||||||
description:
|
description:
|
||||||
- Ansible output that can be quite a bit easier to read than the
|
- Ansible output that can be quite a bit easier to read than the default JSON formatting.
|
||||||
default JSON formatting.
|
extends_documentation_fragment:
|
||||||
extends_documentation_fragment:
|
- default_callback
|
||||||
- default_callback
|
requirements:
|
||||||
requirements:
|
- set as stdout in configuration
|
||||||
- set as stdout in configuration
|
seealso:
|
||||||
seealso:
|
- plugin: ansible.builtin.default
|
||||||
- plugin: ansible.builtin.default
|
plugin_type: callback
|
||||||
plugin_type: callback
|
description: >-
|
||||||
description: >
|
There is a parameter O(ansible.builtin.default#callback:result_format) in P(ansible.builtin.default#callback) that allows
|
||||||
There is a parameter O(ansible.builtin.default#callback:result_format) in P(ansible.builtin.default#callback)
|
you to change the output format to YAML.
|
||||||
that allows you to change the output format to YAML.
|
notes:
|
||||||
notes:
|
- With ansible-core 2.13 or newer, you can instead specify V(yaml) for the parameter O(ansible.builtin.default#callback:result_format)
|
||||||
- >
|
in P(ansible.builtin.default#callback).
|
||||||
With ansible-core 2.13 or newer, you can instead specify V(yaml) for the parameter O(ansible.builtin.default#callback:result_format)
|
"""
|
||||||
in P(ansible.builtin.default#callback).
|
|
||||||
'''
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import json
|
import json
|
||||||
|
|
Loading…
Reference in New Issue