mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 04:00:21 -07:00
fixes to config/setting retrieval
- better variable precedence management - universal plugin option handling - also updated comments for future directions - leverage fragments for plugins - removed fact namespacing - added 'firendly name' field - updated missing descriptions - removed some unused yaml entries, updated others to reflect possible future - documented more plugins - allow reading docs using alias - short licenses - corrected args for 'all plugins' - fixed -a option for ansible-doc - updated vars plugins to allow docs - fixed 'gathering' - only set options IF connection - added path list and renamed pathspec mostly the diff is , vs : as separator - readded removed config entries that were deprecated but had no message ... and deprecated again - now deprecated entries give warning when set
This commit is contained in:
parent
f88750d665
commit
075ead8fb0
70 changed files with 1862 additions and 1292 deletions
|
@ -1,20 +1,19 @@
|
|||
# (c) 2015, Andrew Gaffney <andrew@agaffney.org>
|
||||
#
|
||||
# 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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: actionable
|
||||
type: stdout
|
||||
short_description: shows only items that need attention
|
||||
description:
|
||||
- Use this callback when you dont care about OK nor Skipped.
|
||||
- This callback suppreses any non Failed or Changed status.
|
||||
version_added: "2.1"
|
||||
requirements:
|
||||
- set as stdout callback in configuration
|
||||
'''
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# 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/>.
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: context_demo
|
||||
type: aggregate
|
||||
short_description: demo callback that adds play/task context
|
||||
description:
|
||||
- Displays some play and task context along with normal output
|
||||
- This is mostly for demo purposes
|
||||
version_added: "2.1"
|
||||
requirements:
|
||||
- whitelist in configuration
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: debug
|
||||
type: stdout
|
||||
short_description: formated stdout/stderr display
|
||||
description:
|
||||
- Use this callback to sort though extensive debug output
|
||||
version_added: "2.4"
|
||||
requirements:
|
||||
- set as stdout in configuration
|
||||
'''
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,28 +1,40 @@
|
|||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: default
|
||||
type: stdout
|
||||
short_description: default Ansible screen output
|
||||
version_added: historical
|
||||
description:
|
||||
- This is the default output callback for ansible-playbook.
|
||||
options:
|
||||
show_skipped_hosts:
|
||||
name: Show skipped hosts
|
||||
description: "Toggle to control displaying skipped task/host results in a task"
|
||||
env:
|
||||
- name: DISPLAY_SKIPPED_HOSTS
|
||||
ini:
|
||||
- key: display_skipped_hosts
|
||||
section: defaults
|
||||
type: boolean
|
||||
default: True
|
||||
show_custom_stats:
|
||||
name: Show custom stats
|
||||
default: False
|
||||
description: 'This adds the custom stats set via the set_stats plugin to the play recap'
|
||||
env:
|
||||
- name: ANSIBLE_SHOW_CUSTOM_STATS
|
||||
ini:
|
||||
- key: show_custom_stats
|
||||
section: defaults
|
||||
type: bool
|
||||
requirements:
|
||||
- set as stdout in configuration
|
||||
'''
|
||||
# Make coding more python3-ish
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
# (c) 2016, Dag Wieers <dag@wieers.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# Make coding more python3-ish
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: dense
|
||||
type: stdout
|
||||
short_description: minimal stdout output
|
||||
description:
|
||||
- When in verbose mode it will act the same as the default callback
|
||||
version_added: "2.3"
|
||||
requirements:
|
||||
- set as stdout in configuation
|
||||
'''
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,21 +1,42 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# (C) 2015, 2016 Daniel Lobato <elobatocs@gmail.com>
|
||||
# 2016 Guido Günther <agx@sigxcpu.org>
|
||||
#
|
||||
# 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/>.
|
||||
# (c) 2015, 2016 Daniel Lobato <elobatocs@gmail.com>
|
||||
# (c) 2016 Guido Günther <agx@sigxcpu.org>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: foreman
|
||||
type: notification
|
||||
short_description: Sends events to Foreman
|
||||
description:
|
||||
- This callback will report facts and task events to Foreman https://theforeman.org/
|
||||
version_added: "2.2"
|
||||
requirements:
|
||||
- whitelisting in configuration
|
||||
- requests (python library)
|
||||
options:
|
||||
url:
|
||||
description: URL to the Foreman server
|
||||
env:
|
||||
- name: FOREMAN_URL
|
||||
required: True
|
||||
ssl_cert:
|
||||
description: X509 certificate to authenticate to Foreman if https is used
|
||||
env:
|
||||
- name: FOREMAN_SSL_CERT
|
||||
ssl_key:
|
||||
description: the corresponding private key
|
||||
env:
|
||||
- name: FOREMAN_SSL_KEY
|
||||
verify_certs:
|
||||
description:
|
||||
- Toggle to decidewhether to verify the Foreman certificate.
|
||||
- It can be set to '1' to verify SSL certificates using the installed CAs or to a path pointing to a CA bundle.
|
||||
- Set to '0' to disable certificate checking.
|
||||
env:
|
||||
- name: FOREMAN_SSL_VERIFY
|
||||
'''
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: full_skip
|
||||
type: stdout
|
||||
short_description: suppreses tasks if all hosts skipped
|
||||
description:
|
||||
- Use this plugin when you dont care about any output for tasks that were completly skipped
|
||||
version_added: "2.4"
|
||||
requirements:
|
||||
- set as stdout in configuation
|
||||
'''
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,21 +1,42 @@
|
|||
# (C) 2014, Matt Martz <matt@sivel.net>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# 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/>.
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: hipchat
|
||||
type: notification
|
||||
short_description: post task events to hipchat
|
||||
description:
|
||||
- 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.
|
||||
version_added: "1.6"
|
||||
requirements:
|
||||
- prettytable (python lib)
|
||||
options:
|
||||
token:
|
||||
description: HipChat API token
|
||||
required: True
|
||||
env:
|
||||
- name: HIPCHAT_TOKEN
|
||||
room:
|
||||
description: HipChat room to post in.
|
||||
default: ansible
|
||||
env:
|
||||
- name: HIPCHAT_ROOM
|
||||
from:
|
||||
description: Name to post as
|
||||
default: ansible
|
||||
env:
|
||||
- name: HIPCHAT_FROM
|
||||
notify:
|
||||
description: Add notify flag to important messages
|
||||
type: bool
|
||||
default: True
|
||||
env:
|
||||
- name: HIPCHAT_NOTIFY
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,18 +1,41 @@
|
|||
# Ansible CallBack module for Jabber (XMPP)
|
||||
# Copyright (C) 2016 maxn nikolaev.makc@gmail.com
|
||||
#
|
||||
# This module 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.
|
||||
#
|
||||
# This program 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 this program. If not, see http://www.gnu.org/licenses/
|
||||
# Copyright (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: jabber
|
||||
type: notification
|
||||
short_description: post task events to a jabber server
|
||||
description:
|
||||
- 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.
|
||||
version_added: "2.2"
|
||||
requirements:
|
||||
- xmpp (python lib https://github.com/ArchipelProject/xmpppy)
|
||||
options:
|
||||
server:
|
||||
description: connection info to jabber server
|
||||
required: True
|
||||
env:
|
||||
- name: JABBER_SERV
|
||||
user:
|
||||
description: Jabber user to authenticate as
|
||||
required: True
|
||||
env:
|
||||
- name: JABBER_USER
|
||||
password:
|
||||
description: Password for the user to the jabber server
|
||||
required: True
|
||||
env:
|
||||
- name: JABBER_PASS
|
||||
to:
|
||||
description: chat identifier that will recieve the message
|
||||
required: True
|
||||
env:
|
||||
- name: JABBER_TO
|
||||
'''
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -48,9 +71,9 @@ class CallbackModule(CallbackBase):
|
|||
self.j_pass = os.getenv('JABBER_PASS')
|
||||
self.j_to = os.getenv('JABBER_TO')
|
||||
|
||||
if (self.j_user or self.j_pass or self.serv) is None:
|
||||
if (self.j_user or self.j_pass or self.serv or self.j_to) is None:
|
||||
self.disabled = True
|
||||
self._display.warning('Jabber CallBack want JABBER_USER and JABBER_PASS env variables')
|
||||
self._display.warning('Jabber CallBack wants the JABBER_SERV, JABBER_USER, JABBER_PASS and JABBER_TO environment variables')
|
||||
|
||||
def send_msg(self, msg):
|
||||
"""Send message"""
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
# (c) 2016, Matt Martz <matt@sivel.net>
|
||||
#
|
||||
# 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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: json
|
||||
short_description: Ansbile screen output asjson
|
||||
short_description: Ansbile screen output as JSON
|
||||
version_added: "2.2"
|
||||
description:
|
||||
- This callback converts all events into JSON output
|
||||
- This callback converts all events into JSON output to stdout
|
||||
type: stdout
|
||||
plugin_api_version: "2.0"
|
||||
requirements:
|
||||
- Set as stdout in config
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
|
|
|
@ -1,19 +1,44 @@
|
|||
# (c) 2016 Matt Clay <matt@mystile.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: junit
|
||||
type: aggregate
|
||||
short_description: write playbook output to a JUnit file.
|
||||
version_added: historical
|
||||
description:
|
||||
- This 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"
|
||||
options:
|
||||
output_dir:
|
||||
name: JUnit output dir
|
||||
default: ~/.ansible.log
|
||||
description: Directory to write XML files to.
|
||||
env:
|
||||
- name: JUNIT_OUTPUT_DIR
|
||||
task_class:
|
||||
name: JUnit Task class
|
||||
default: False
|
||||
description: Configure the output to be one class per yaml file
|
||||
env:
|
||||
- name: JUNIT_TASK_CLASS
|
||||
fail_on_change:
|
||||
name: JUnit fail on change
|
||||
default: False
|
||||
description: Consider any tasks reporting "changed" as a junit test failure
|
||||
env:
|
||||
- name: JUNIT_FAIL_ON_CHANGE
|
||||
requirements:
|
||||
- whitelist in configuration
|
||||
- junit_xml (python lib)
|
||||
'''
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.com>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# 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/>.
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: log_plays
|
||||
type: notification
|
||||
short_description: write playbook output to log file
|
||||
version_added: historical
|
||||
description:
|
||||
- This callback writes playbook output to a file per host in the `/var/log/ansible/hosts` directory
|
||||
- "TODO: make this configurable"
|
||||
requirements:
|
||||
- Whitelist in configuration
|
||||
- A writeable /var/log/ansible/hosts directory by the user executing Ansbile on the controller
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,46 +1,84 @@
|
|||
""" (c) 2015, Logentries.com, Jimmy Tang <jimmy.tang@logentries.com>
|
||||
# (c) 2015, Logentries.com, Jimmy Tang <jimmy.tang@logentries.com>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# 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
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: logentries
|
||||
type: notification
|
||||
short_description: Sends events to Logentries
|
||||
description:
|
||||
- This callback plugin will generate JSON objects and send them to Logentries for auditing/debugging purposes.
|
||||
- If you want to use an ini configuration, the file must be placed in the same directory as this plugin and named logentries.ini
|
||||
version_added: "2.0"
|
||||
requirements:
|
||||
- whitelisting in configuration
|
||||
- certifi (python library)
|
||||
- flatdict (pytnon library)
|
||||
options:
|
||||
api:
|
||||
description: URI to the Logentries API
|
||||
env:
|
||||
- name: LOGENTRIES_API
|
||||
default: data.logentries.com
|
||||
ini:
|
||||
- section: defaults
|
||||
key: api
|
||||
port:
|
||||
description: Http port to use when connecting to the API
|
||||
env:
|
||||
- name: LOGENTRIES_PORT
|
||||
default: 80
|
||||
ini:
|
||||
- section: defaults
|
||||
key: port
|
||||
tls_port:
|
||||
description: Port to use when connecting to the API when TLS is enabled
|
||||
env:
|
||||
- name: LOGENTRIES_TLS_PORT
|
||||
default: 443
|
||||
ini:
|
||||
- section: defaults
|
||||
key: tls_port
|
||||
token:
|
||||
description: the authentication token
|
||||
env:
|
||||
- name: LOGENTRIES_ANSIBLE_TOKEN
|
||||
required: True
|
||||
ini:
|
||||
- section: defaults
|
||||
key: token
|
||||
use_tls:
|
||||
description:
|
||||
- Toggle to decidewhether to use TLS to encrypt the communications with the API server
|
||||
env:
|
||||
- name: LOGENTRIES_USE_TLS
|
||||
default: False
|
||||
type: boolean
|
||||
ini:
|
||||
- section: defaults
|
||||
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: defaults
|
||||
key: flatten
|
||||
EXAMPLES: >
|
||||
To enable, 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
|
||||
|
||||
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
|
||||
|
||||
Or create a logentries.ini config file that sites next to the plugin with the following contents
|
||||
[logentries]
|
||||
api = data.logentries.com
|
||||
port = 10000
|
||||
|
@ -48,10 +86,7 @@ Or create a logentries.ini config file that sites next to the plugin with the fo
|
|||
use_tls = no
|
||||
token = dd21fc88-f00a-43ff-b977-e3a4233c53af
|
||||
flatten = False
|
||||
|
||||
|
||||
"""
|
||||
|
||||
'''
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -59,7 +94,6 @@ import os
|
|||
import socket
|
||||
import random
|
||||
import time
|
||||
import codecs
|
||||
import uuid
|
||||
|
||||
try:
|
||||
|
@ -77,6 +111,10 @@ except ImportError:
|
|||
from ansible.module_utils.six.moves import configparser
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
"""
|
||||
Todo:
|
||||
* Better formatting of output before sending out to logentries data/api nodes.
|
||||
"""
|
||||
|
||||
|
||||
class PlainTextSocketAppender(object):
|
||||
|
@ -92,8 +130,7 @@ class PlainTextSocketAppender(object):
|
|||
self.MIN_DELAY = 0.1
|
||||
self.MAX_DELAY = 10
|
||||
# Error message displayed when an incorrect Token has been detected
|
||||
self.INVALID_TOKEN = ("\n\nIt appears the LOGENTRIES_TOKEN "
|
||||
"parameter you entered is incorrect!\n\n")
|
||||
self.INVALID_TOKEN = ("\n\nIt appears the LOGENTRIES_TOKEN parameter you entered is incorrect!\n\n")
|
||||
# Unicode Line separator character \u2028
|
||||
self.LINE_SEP = u'\u2028'
|
||||
|
||||
|
@ -189,15 +226,17 @@ class CallbackModule(CallbackBase):
|
|||
if not HAS_SSL:
|
||||
self._display.warning("Unable to import ssl module. Will send over port 80.")
|
||||
|
||||
warn = ''
|
||||
if not HAS_CERTIFI:
|
||||
self.disabled = True
|
||||
self._display.warning('The `certifi` python module is not installed. '
|
||||
'Disabling the Logentries callback plugin.')
|
||||
warn += 'The `certifi` python module is not installed.'
|
||||
|
||||
if not HAS_FLATDICT:
|
||||
self.disabled = True
|
||||
self._display.warning('The `flatdict` python module is not installed. '
|
||||
'Disabling the Logentries callback plugin.')
|
||||
warn += 'The `flatdict` python module is not installed.'
|
||||
|
||||
if warn:
|
||||
self._display.warning('%s\nDisabling the Logentries callback plugin.' % warn)
|
||||
|
||||
config_path = os.path.abspath(os.path.dirname(__file__))
|
||||
config = configparser.ConfigParser()
|
||||
|
|
|
@ -1,19 +1,35 @@
|
|||
# (C) 2016, Ievgen Khmelenko <ujenmr@gmail.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/>.
|
||||
# (C) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: logstash
|
||||
type: notification
|
||||
short_description: Sends events to Logstash
|
||||
description:
|
||||
- This callback will report facts and task events to Foreman https://theforeman.org/
|
||||
version_added: "2.3"
|
||||
requirements:
|
||||
- whitelisting in configuration
|
||||
- logstash (python library)
|
||||
options:
|
||||
server:
|
||||
description: Address of the Logstash server
|
||||
env:
|
||||
- name: LOGSTASH_SERVER
|
||||
default: localhost
|
||||
port:
|
||||
description: Port on which logstash is listening
|
||||
env:
|
||||
- name: LOGSTASH_PORT
|
||||
default: 5000
|
||||
type:
|
||||
description: Message type
|
||||
env:
|
||||
- name: LOGSTASH_TYPE
|
||||
default: ansible
|
||||
'''
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,8 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2012, Dag Wieers <dag@wieers.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: mail
|
||||
type: notification
|
||||
short_description: Sends failure events via email
|
||||
description:
|
||||
- This callback will report failures via email
|
||||
version_added: "2.3"
|
||||
requirements:
|
||||
- whitelisting in configuration
|
||||
- logstash (python library)
|
||||
options:
|
||||
mta:
|
||||
description: Mail Transfer Agent, server that accepts SMTP
|
||||
env:
|
||||
- name: SMTPHOST
|
||||
default: localhost
|
||||
note:
|
||||
- "TODO: expand configuration options now that plugins can leverage Ansible's configuration"
|
||||
'''
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: minimal
|
||||
type: stdout
|
||||
short_description: minimal Ansible screen output
|
||||
version_added: historical
|
||||
description:
|
||||
- This is the default output callback used by the ansible command (ad-hoc)
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: oneline
|
||||
type: stdout
|
||||
short_description: oneline Ansible screen output
|
||||
version_added: historical
|
||||
description:
|
||||
- This is the output callback used by the -o/--one-line command line option.
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
# (c) 2012, Michael DeHaan, <michael.dehaan@gmail.com>
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# (C) 2012, Michael DeHaan, <michael.dehaan@gmail.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/>.
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: osx_say
|
||||
type: notification
|
||||
requirements:
|
||||
- whitelising in configuration
|
||||
- the '/usr/bin/say' command line program (standard on OS X)
|
||||
short_description: oneline Ansible screen output
|
||||
version_added: historical
|
||||
description:
|
||||
- This plugin will use the 'say' program to "speak" about play events.
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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/>.
|
||||
# (c) 2017 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
'''
|
||||
DOCUMENTATION:
|
||||
callback: skippy
|
||||
callback_type: stdout
|
||||
requires: set as display
|
||||
short_description: Ansible screen output that ignores skipped status
|
||||
version_added: "2.0"
|
||||
description:
|
||||
- This callback does the same as the default except it does not output skipped host/task/item status
|
||||
'''
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue