ansible.plugins.callback package¶
- 
class 
ansible.plugins.callback.CallbackBase(display=None)[source]¶ Bases:
objectThis is a base ansible callback class that does nothing. New callbacks should use this class as a base and override any callback methods they wish to execute custom actions.
- 
playbook_on_vars_prompt(varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None)[source]¶ 
- 
 
Submodules¶
ansible.plugins.callback.actionable module¶
ansible.plugins.callback.context_demo module¶
- 
class 
ansible.plugins.callback.context_demo.CallbackModule(*args, **kwargs)[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is a very trivial example of how any callback function can get at play and task objects. play will be ‘None’ for runner invocations, and task will be None for ‘setup’ invocations.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'aggregate'¶ 
- 
CALLBACK_NAME= 'context_demo'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
- 
 
ansible.plugins.callback.default module¶
- 
class 
ansible.plugins.callback.default.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is the default callback interface, which simply prints messages to stdout when new callback events are received.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'stdout'¶ 
- 
CALLBACK_NAME= 'default'¶ 
- 
 
ansible.plugins.callback.hipchat module¶
- 
class 
ansible.plugins.callback.hipchat.CallbackModule[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is an example ansible callback plugin that sends status updates to a HipChat channel during playbook execution.
- This plugin makes use of the following environment variables:
 - HIPCHAT_TOKEN (required): HipChat API token HIPCHAT_ROOM (optional): HipChat room to post in. Default: ansible HIPCHAT_FROM (optional): Name to post as. Default: ansible HIPCHAT_NOTIFY (optional): Add notify flag to important messages (“true” or “false”). Default: true
 - Requires:
 - prettytable
 
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'notification'¶ 
- 
CALLBACK_NAME= 'hipchat'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
ansible.plugins.callback.json module¶
- 
class 
ansible.plugins.callback.json.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.CallbackBase- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'stdout'¶ 
- 
CALLBACK_NAME= 'json'¶ 
- 
v2_runner_on_failed(result, **kwargs)¶ 
- 
v2_runner_on_unreachable(result, **kwargs)¶ 
- 
v2_runner_on_skipped(result, **kwargs)¶ 
- 
 
ansible.plugins.callback.junit module¶
- 
class 
ansible.plugins.callback.junit.CallbackModule[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis callback writes playbook output to a JUnit formatted XML file.
- Tasks show up in the report as follows:
 - ‘ok’: pass ‘failed’ with ‘EXPECTED FAILURE’ in the task name: pass ‘failed’ due to an exception: error ‘failed’ for other reasons: failure ‘skipped’: skipped
 - This plugin makes use of the following environment variables:
 - JUNIT_OUTPUT_DIR (optional): Directory to write XML files to.
 - Default: ~/.ansible.log
 
- Requires:
 - junit_xml
 
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'aggregate'¶ 
- 
CALLBACK_NAME= 'junit'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
ansible.plugins.callback.log_plays module¶
- 
class 
ansible.plugins.callback.log_plays.CallbackModule[source]¶ Bases:
ansible.plugins.callback.CallbackBaselogs playbook results, per host, in /var/log/ansible/hosts
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'notification'¶ 
- 
CALLBACK_NAME= 'log_plays'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
- 
TIME_FORMAT= '%b %d %Y %H:%M:%S'¶ 
- 
MSG_FORMAT= '%(now)s - %(category)s - %(data)s\n\n'¶ 
- 
 
ansible.plugins.callback.logentries module¶
- 2015, Logentries.com, Jimmy Tang <jimmy.tang@logentries.com>
 
# This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
This callback plugin will generate json objects to be sent to logentries for auditing/debugging purposes.
Todo:
- Better formatting of output before sending out to logentries data/api nodes.
 
To use:
Add this to your ansible.cfg file in the defaults block
[defaults] callback_plugins = ./callback_plugins callback_stdout = logentries callback_whitelist = logentries
Copy the callback plugin into the callback_plugins directory
Either set the environment variables
export LOGENTRIES_API=data.logentries.com export LOGENTRIES_PORT=10000 export LOGENTRIES_ANSIBLE_TOKEN=dd21fc88-f00a-43ff-b977-e3a4233c53af
Or create a logentries.ini config file that sites next to the plugin with the following contents
[logentries] api = data.logentries.com port = 10000 tls_port = 20000 use_tls = no token = dd21fc88-f00a-43ff-b977-e3a4233c53af flatten = False
- 
class 
ansible.plugins.callback.logentries.PlainTextSocketAppender(verbose=True, LE_API='data.logentries.com', LE_PORT=80, LE_TLS_PORT=443)[source]¶ Bases:
object
- 
class 
ansible.plugins.callback.logentries.TLSSocketAppender(verbose=True, LE_API='data.logentries.com', LE_PORT=80, LE_TLS_PORT=443)[source]¶ Bases:
ansible.plugins.callback.logentries.PlainTextSocketAppender
- 
ansible.plugins.callback.logentries.SocketAppender¶ alias of
TLSSocketAppender
ansible.plugins.callback.mail module¶
- 
ansible.plugins.callback.mail.mail(subject='Ansible error mail', sender=None, to=None, cc=None, bcc=None, body=None, smtphost=None)[source]¶ 
ansible.plugins.callback.minimal module¶
- 
class 
ansible.plugins.callback.minimal.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is the default callback interface, which simply prints messages to stdout when new callback events are received.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'stdout'¶ 
- 
CALLBACK_NAME= 'minimal'¶ 
- 
 
ansible.plugins.callback.oneline module¶
- 
class 
ansible.plugins.callback.oneline.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is the default callback interface, which simply prints messages to stdout when new callback events are received.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'stdout'¶ 
- 
CALLBACK_NAME= 'oneline'¶ 
- 
 
ansible.plugins.callback.osx_say module¶
ansible.plugins.callback.profile_tasks module¶
- 
class 
ansible.plugins.callback.profile_tasks.CallbackModule[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis callback module provides per-task timing, ongoing playbook elapsed time and ordered list of top 20 longest running tasks at end.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'aggregate'¶ 
- 
CALLBACK_NAME= 'profile_tasks'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
- 
 
ansible.plugins.callback.skippy module¶
- 
class 
ansible.plugins.callback.skippy.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.default.CallbackModuleThis is the default callback interface, which simply prints messages to stdout when new callback events are received.
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'stdout'¶ 
- 
CALLBACK_NAME= 'skippy'¶ 
- 
 
ansible.plugins.callback.slack module¶
- 
class 
ansible.plugins.callback.slack.CallbackModule(display=None)[source]¶ Bases:
ansible.plugins.callback.CallbackBaseThis is an ansible callback plugin that sends status updates to a Slack channel during playbook execution.
- This plugin makes use of the following environment variables:
 SLACK_WEBHOOK_URL (required): Slack Webhook URL SLACK_CHANNEL (optional): Slack room to post in. Default: #ansible SLACK_USERNAME (optional): Username to post as. Default: ansible SLACK_INVOCATION (optional): Show command line invocation
details. Default: False- Requires:
 - prettytable
 
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'notification'¶ 
- 
CALLBACK_NAME= 'slack'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶ 
ansible.plugins.callback.syslog_json module¶
- 
class 
ansible.plugins.callback.syslog_json.CallbackModule[source]¶ Bases:
ansible.plugins.callback.CallbackBaselogs ansible-playbook and ansible runs to a syslog server in json format make sure you have in ansible.cfg:
callback_plugins = <path_to_callback_plugins_folder>and put the plugin in <path_to_callback_plugins_folder>
- This plugin makes use of the following environment variables:
 - SYSLOG_SERVER (optional): defaults to localhost SYSLOG_PORT (optional): defaults to 514
 
- 
CALLBACK_VERSION= 2.0¶ 
- 
CALLBACK_TYPE= 'aggregate'¶ 
- 
CALLBACK_NAME= 'syslog_json'¶ 
- 
CALLBACK_NEEDS_WHITELIST= True¶