From f9d817e636f1840cacc8cf4ac5a306cbeb402eae Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:23:01 -0400 Subject: [PATCH 01/12] now looks at correct verbosity and removes the need to set a copy of it in _verbosity --- lib/ansible/plugins/callback/default.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py index 071cb8e48ad..9bdb756aa19 100644 --- a/lib/ansible/plugins/callback/default.py +++ b/lib/ansible/plugins/callback/default.py @@ -34,7 +34,7 @@ class CallbackModule(CallbackBase): CALLBACK_TYPE = 'stdout' def v2_on_any(self, *args, **kwargs): - pass + self.on_any(args, kwargs) def v2_runner_on_failed(self, result, ignore_errors=False): if 'exception' in result._result: @@ -67,7 +67,7 @@ class CallbackModule(CallbackBase): msg = "ok: [%s]" % result._host.get_name() color = 'green' - if (self._display._verbosity > 0 or 'verbose_always' in result._result) and result._task.action not in ('setup', 'include'): + if (self._display.verbosity > 0 or 'verbose_always' in result._result) and result._task.action not in ('setup', 'include'): indent = None if 'verbose_always' in result._result: indent = 4 @@ -77,7 +77,7 @@ class CallbackModule(CallbackBase): def v2_runner_on_skipped(self, result): msg = "skipping: [%s]" % result._host.get_name() - if self._display._verbosity > 0 or 'verbose_always' in result._result: + if self._display.verbosity > 0 or 'verbose_always' in result._result: indent = None if 'verbose_always' in result._result: indent = 4 From a918a1bd1652b727c46b3238d0cb8d8220e2c433 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:36:30 -0400 Subject: [PATCH 02/12] now calls correct v2_on_any callback method --- lib/ansible/executor/task_queue_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 2504a179fc0..41e28c3baef 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -296,7 +296,7 @@ class TaskQueueManager: continue methods = [ getattr(callback_plugin, method_name, None), - getattr(callback_plugin, 'on_any', None) + getattr(callback_plugin, 'v2_on_any', None) ] for method in methods: if method is not None: From ba0e5323d6feca04b721ae164e69b68bc1e97b92 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:38:39 -0400 Subject: [PATCH 03/12] removed connection info to _verbosity, just needed callbacks to call correct display.verbosity added v2 methods and made them call v1 when possible by tranforming the data --- lib/ansible/plugins/callback/__init__.py | 91 +++++++++++++++++++++++- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index c03f6981d9c..e430c9b5db7 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -36,9 +36,7 @@ class CallbackBase: self._display = display def set_connection_info(self, conn_info): - # FIXME: this is a temporary hack, as the connection info object - # should be created early and passed down through objects - self._display._verbosity = conn_info.verbosity + pass def on_any(self, *args, **kwargs): pass @@ -100,3 +98,90 @@ class CallbackBase: def playbook_on_stats(self, stats): pass + ####### V2 METHODS, by default they call v1 counterparts if possible ###### + def v2_on_any(self, *args, **kwargs): + self.on_any(args, kwargs) + + def v2_runner_on_failed(self, result, ignore_errors=False): + host = result._host.get_name() + self.runner_on_failed(host, result._result, ignore_errors) + + def v2_runner_on_ok(self, result): + host = result._host.get_name() + self.runner_on_ok(host, result._result) + + def v2_runner_on_skipped(self, result): + host = result._host.get_name() + #FIXME, get item to pass through + item = None + self.runner_on_skipped(host, result._result, item) + + def v2_runner_on_unreachable(self, result): + host = result._host.get_name() + self.runner_on_unreachable(host, result._result) + + def v2_runner_on_no_hosts(self, task): + self.runner_on_no_hosts() + + def v2_runner_on_async_poll(self, result): + host = result._host.get_name() + jid = result._result.get('ansible_job_id') + #FIXME, get real clock + clock = 0 + self.runner_on_async_poll(host, result._result, jid, clock) + + def v2_runner_on_async_ok(self, result): + host = result._host.get_name() + jid = result._result.get('ansible_job_id') + self.runner_on_async_ok(host, result._result, jid) + + def v2_runner_on_async_failed(self, result): + host = result._host.get_name() + jid = result._result.get('ansible_job_id') + self.runner_on_async_failed(host, result._result, jid) + + def v2_runner_on_file_diff(self, result, diff): + pass #no v1 correspondance + + def v2_playbook_on_start(self): + self.playbook_on_start() + + def v2_playbook_on_notify(self, result, handler): + host = result._host.get_name() + self.playbook_on_notify(host, handler) + + def v2_playbook_on_no_hosts_matched(self): + self.playbook_on_no_hosts_matched() + + def v2_playbook_on_no_hosts_remaining(self): + self.playbook_on_no_hosts_remaining() + + def v2_playbook_on_task_start(self, task, is_conditional): + self.playbook_on_task_start(task, is_conditional) + + def v2_playbook_on_cleanup_task_start(self, task): + pass #no v1 correspondance + + def v2_playbook_on_handler_task_start(self, task): + pass #no v1 correspondance + + def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): + self.playbook_on_vars_prompt(varname, private, prompt, encrypt, confirm, salt_size, salt, default) + + def v2_playbook_on_setup(self): + self.playbook_on_setup() + + def v2_playbook_on_import_for_host(self, result, imported_file): + host = result._host.get_name() + self.playbook_on_import_for_host(host, imported_file) + + def v2_playbook_on_not_import_for_host(self, result, missing_file): + host = result._host.get_name() + self.playbook_on_not_import_for_host(host, missing_file) + + def v2_playbook_on_play_start(self, play): + self.playbook_on_play_start(play.name) + + def v2_playbook_on_stats(self, stats): + self.playbook_on_stats(stats) + From 834b7a2857bef5a92f27c2283a847eefcfafb62a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:39:21 -0400 Subject: [PATCH 04/12] ported context_demo to v2 callbacks --- .../ansible/plugins/callback}/context_demo.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) rename {plugins/callbacks => lib/ansible/plugins/callback}/context_demo.py (65%) diff --git a/plugins/callbacks/context_demo.py b/lib/ansible/plugins/callback/context_demo.py similarity index 65% rename from plugins/callbacks/context_demo.py rename to lib/ansible/plugins/callback/context_demo.py index 5c3015d85f6..f204ecb3bed 100644 --- a/plugins/callbacks/context_demo.py +++ b/lib/ansible/plugins/callback/context_demo.py @@ -15,17 +15,23 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import os -import time -import json +from ansible.plugins.callback import CallbackBase -class CallbackModule(object): +class CallbackModule(CallbackBase): """ This 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' - def on_any(self, *args, **kwargs): - play = getattr(self, 'play', None) - task = getattr(self, 'task', None) - print "play = %s, task = %s, args = %s, kwargs = %s" % (play,task,args,kwargs) + def v2_on_any(self, *args, **kwargs): + i = 0 + self._display.display(" --- ARGS ") + for a in args: + self._display.display(' %s: %s' % (i, a)) + i += 1 + + self._display.display(" --- KWARGS ") + for k in kwargs: + self._display.display(' %s: %s' % (k, kwargs[k])) From b47d7babe5b1ebd20093731a14fa654b5cc5469f Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:55:23 -0400 Subject: [PATCH 05/12] removed warning i was using for debug --- lib/ansible/plugins/callback/timer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/callback/timer.py b/lib/ansible/plugins/callback/timer.py index 4b28a19af09..d7f2b42a964 100644 --- a/lib/ansible/plugins/callback/timer.py +++ b/lib/ansible/plugins/callback/timer.py @@ -12,13 +12,12 @@ class CallbackModule(CallbackBase): CALLBACK_TYPE = 'aggregate' start_time = datetime.now() - + def __init__(self, display): - super(CallbackModule, self).__init__(display) + super(CallbackModule, self).__init__(display) start_time = datetime.now() - self._display.warning("Timerv2 plugin is active from included callbacks.") def days_hours_minutes_seconds(self, timedelta): minutes = (timedelta.seconds//60)%60 @@ -27,7 +26,7 @@ class CallbackModule(CallbackBase): def playbook_on_stats(self, stats): self.v2_playbook_on_stats(stats) - + def v2_playbook_on_stats(self, stats): end_time = datetime.now() timedelta = end_time - self.start_time From e92e15b5f656d01aa1753faaa86d4240a4ddcff3 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 19:55:49 -0400 Subject: [PATCH 06/12] moved unused functions to base object --- lib/ansible/plugins/callback/default.py | 40 ------------------------- 1 file changed, 40 deletions(-) diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py index 9bdb756aa19..2c4a8cea88b 100644 --- a/lib/ansible/plugins/callback/default.py +++ b/lib/ansible/plugins/callback/default.py @@ -33,9 +33,6 @@ class CallbackModule(CallbackBase): CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'stdout' - def v2_on_any(self, *args, **kwargs): - self.on_any(args, kwargs) - def v2_runner_on_failed(self, result, ignore_errors=False): if 'exception' in result._result: if self._display.verbosity < 3: @@ -88,27 +85,6 @@ class CallbackModule(CallbackBase): def v2_runner_on_unreachable(self, result): self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), result._result), color='red') - def v2_runner_on_no_hosts(self, task): - pass - - def v2_runner_on_async_poll(self, result): - pass - - def v2_runner_on_async_ok(self, result): - pass - - def v2_runner_on_async_failed(self, result): - pass - - def v2_runner_on_file_diff(self, result, diff): - pass - - def v2_playbook_on_start(self): - pass - - def v2_playbook_on_notify(self, result, handler): - pass - def v2_playbook_on_no_hosts_matched(self): self._display.display("skipping: no hosts matched", color='cyan') @@ -124,18 +100,6 @@ class CallbackModule(CallbackBase): def v2_playbook_on_handler_task_start(self, task): self._display.banner("RUNNING HANDLER [%s]" % task.get_name().strip()) - #def v2_playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): - # pass - - def v2_playbook_on_setup(self): - pass - - def v2_playbook_on_import_for_host(self, result, imported_file): - pass - - def v2_playbook_on_not_import_for_host(self, result, missing_file): - pass - def v2_playbook_on_play_start(self, play): name = play.get_name().strip() if not name: @@ -144,7 +108,3 @@ class CallbackModule(CallbackBase): msg = "PLAY [%s]" % name self._display.banner(name) - - def v2_playbook_on_stats(self, stats): - pass - From 50d54b1be7759eb360cd2bc8dc9484b1f85ff73d Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 20:04:54 -0400 Subject: [PATCH 07/12] ported hipchat callback to v2 (needs testing) --- .../ansible/plugins/callback}/hipchat.py | 73 +++---------------- 1 file changed, 11 insertions(+), 62 deletions(-) rename {plugins/callbacks => lib/ansible/plugins/callback}/hipchat.py (77%) diff --git a/plugins/callbacks/hipchat.py b/lib/ansible/plugins/callback/hipchat.py similarity index 77% rename from plugins/callbacks/hipchat.py rename to lib/ansible/plugins/callback/hipchat.py index 45c2e2c8197..a2709e3d5b9 100644 --- a/plugins/callbacks/hipchat.py +++ b/lib/ansible/plugins/callback/hipchat.py @@ -19,16 +19,15 @@ import os import urllib import urllib2 -from ansible import utils - try: import prettytable HAS_PRETTYTABLE = True except ImportError: HAS_PRETTYTABLE = False +from ansible.plugins.callback import CallbackBase -class CallbackModule(object): +class CallbackModule(CallbackBase): """This is an example ansible callback plugin that sends status updates to a HipChat channel during playbook execution. @@ -42,11 +41,16 @@ class CallbackModule(object): prettytable """ + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'notification' + + def __init__(self, display): + + super(CallbackModule, self).__init__(display) - def __init__(self): if not HAS_PRETTYTABLE: self.disabled = True - utils.warning('The `prettytable` python module is not installed. ' + self.display.warning('The `prettytable` python module is not installed. ' 'Disabling the HipChat callback plugin.') self.msg_uri = 'https://api.hipchat.com/v1/rooms/message' @@ -57,7 +61,7 @@ class CallbackModule(object): if self.token is None: self.disabled = True - utils.warning('HipChat token could not be loaded. The HipChat ' + self.display.warning('HipChat token could not be loaded. The HipChat ' 'token can be provided using the `HIPCHAT_TOKEN` ' 'environment variable.') @@ -80,63 +84,8 @@ class CallbackModule(object): response = urllib2.urlopen(url, urllib.urlencode(params)) return response.read() except: - utils.warning('Could not submit message to hipchat') + self.display.warning('Could not submit message to hipchat') - def on_any(self, *args, **kwargs): - pass - - def runner_on_failed(self, host, res, ignore_errors=False): - pass - - def runner_on_ok(self, host, res): - pass - - def runner_on_skipped(self, host, item=None): - pass - - def runner_on_unreachable(self, host, res): - pass - - def runner_on_no_hosts(self): - pass - - def runner_on_async_poll(self, host, res, jid, clock): - pass - - def runner_on_async_ok(self, host, res, jid): - pass - - def runner_on_async_failed(self, host, res, jid): - pass - - def playbook_on_start(self): - pass - - def playbook_on_notify(self, host, handler): - pass - - def playbook_on_no_hosts_matched(self): - pass - - def playbook_on_no_hosts_remaining(self): - pass - - def playbook_on_task_start(self, name, is_conditional): - pass - - def playbook_on_vars_prompt(self, varname, private=True, prompt=None, - encrypt=None, confirm=False, salt_size=None, - salt=None, default=None): - pass - - def playbook_on_setup(self): - pass - - def playbook_on_import_for_host(self, host, imported_file): - pass - - def playbook_on_not_import_for_host(self, host, missing_file): - pass def playbook_on_play_start(self, name): """Display Playbook and play start messages""" From d0c6d2ff1c9f1bcf7c6a1fc717daaeffa5f38b48 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 20:37:17 -0400 Subject: [PATCH 08/12] poreted log_plays, syslog_json and osx_say callbacks to v2 renamed plugins to contrib (they are not really plugins) rewrote README.md to reflect new usage added new dir to setup.py so it gets copied with installation, in views of making using inventory scripts easier in teh future --- contrib/README.md | 17 +++ {plugins => contrib}/inventory/abiquo.ini | 0 {plugins => contrib}/inventory/abiquo.py | 0 .../inventory/apache-libcloud.py | 0 {plugins => contrib}/inventory/cloudstack.ini | 0 {plugins => contrib}/inventory/cloudstack.py | 0 {plugins => contrib}/inventory/cobbler.ini | 0 {plugins => contrib}/inventory/cobbler.py | 0 {plugins => contrib}/inventory/collins.ini | 0 {plugins => contrib}/inventory/collins.py | 0 {plugins => contrib}/inventory/consul.ini | 0 {plugins => contrib}/inventory/consul_io.py | 0 .../inventory/digital_ocean.ini | 0 .../inventory/digital_ocean.py | 0 {plugins => contrib}/inventory/docker.py | 0 {plugins => contrib}/inventory/docker.yml | 0 {plugins => contrib}/inventory/ec2.ini | 0 {plugins => contrib}/inventory/ec2.py | 0 {plugins => contrib}/inventory/fleet.py | 0 {plugins => contrib}/inventory/freeipa.py | 0 {plugins => contrib}/inventory/gce.ini | 0 {plugins => contrib}/inventory/gce.py | 0 {plugins => contrib}/inventory/jail.py | 0 {plugins => contrib}/inventory/landscape.py | 0 {plugins => contrib}/inventory/libcloud.ini | 0 {plugins => contrib}/inventory/libvirt_lxc.py | 0 {plugins => contrib}/inventory/linode.ini | 0 {plugins => contrib}/inventory/linode.py | 0 {plugins => contrib}/inventory/nova.ini | 0 {plugins => contrib}/inventory/nova.py | 0 {plugins => contrib}/inventory/openshift.py | 0 {plugins => contrib}/inventory/openstack.py | 0 {plugins => contrib}/inventory/openstack.yml | 0 {plugins => contrib}/inventory/ovirt.ini | 0 {plugins => contrib}/inventory/ovirt.py | 0 {plugins => contrib}/inventory/rax.ini | 0 {plugins => contrib}/inventory/rax.py | 0 {plugins => contrib}/inventory/serf.py | 0 {plugins => contrib}/inventory/softlayer.py | 0 {plugins => contrib}/inventory/spacewalk.py | 0 {plugins => contrib}/inventory/ssh_config.py | 0 {plugins => contrib}/inventory/vagrant.py | 0 {plugins => contrib}/inventory/vbox.py | 0 {plugins => contrib}/inventory/vmware.ini | 0 {plugins => contrib}/inventory/vmware.py | 0 .../inventory/windows_azure.ini | 0 .../inventory/windows_azure.py | 0 {plugins => contrib}/inventory/zabbix.ini | 0 {plugins => contrib}/inventory/zabbix.py | 0 {plugins => contrib}/inventory/zone.py | 0 lib/ansible/plugins/callback/log_plays.py | 85 +++++++++++++ .../ansible/plugins/callback}/osx_say.py | 70 ++++------- .../ansible/plugins/callback}/syslog_json.py | 49 ++------ plugins/README.md | 35 ------ plugins/callbacks/log_plays.py | 116 ------------------ setup.py | 2 +- 56 files changed, 138 insertions(+), 236 deletions(-) create mode 100644 contrib/README.md rename {plugins => contrib}/inventory/abiquo.ini (100%) rename {plugins => contrib}/inventory/abiquo.py (100%) rename {plugins => contrib}/inventory/apache-libcloud.py (100%) rename {plugins => contrib}/inventory/cloudstack.ini (100%) rename {plugins => contrib}/inventory/cloudstack.py (100%) rename {plugins => contrib}/inventory/cobbler.ini (100%) rename {plugins => contrib}/inventory/cobbler.py (100%) rename {plugins => contrib}/inventory/collins.ini (100%) rename {plugins => contrib}/inventory/collins.py (100%) rename {plugins => contrib}/inventory/consul.ini (100%) rename {plugins => contrib}/inventory/consul_io.py (100%) rename {plugins => contrib}/inventory/digital_ocean.ini (100%) rename {plugins => contrib}/inventory/digital_ocean.py (100%) rename {plugins => contrib}/inventory/docker.py (100%) rename {plugins => contrib}/inventory/docker.yml (100%) rename {plugins => contrib}/inventory/ec2.ini (100%) rename {plugins => contrib}/inventory/ec2.py (100%) rename {plugins => contrib}/inventory/fleet.py (100%) rename {plugins => contrib}/inventory/freeipa.py (100%) rename {plugins => contrib}/inventory/gce.ini (100%) rename {plugins => contrib}/inventory/gce.py (100%) rename {plugins => contrib}/inventory/jail.py (100%) rename {plugins => contrib}/inventory/landscape.py (100%) rename {plugins => contrib}/inventory/libcloud.ini (100%) rename {plugins => contrib}/inventory/libvirt_lxc.py (100%) rename {plugins => contrib}/inventory/linode.ini (100%) rename {plugins => contrib}/inventory/linode.py (100%) rename {plugins => contrib}/inventory/nova.ini (100%) rename {plugins => contrib}/inventory/nova.py (100%) rename {plugins => contrib}/inventory/openshift.py (100%) rename {plugins => contrib}/inventory/openstack.py (100%) rename {plugins => contrib}/inventory/openstack.yml (100%) rename {plugins => contrib}/inventory/ovirt.ini (100%) rename {plugins => contrib}/inventory/ovirt.py (100%) rename {plugins => contrib}/inventory/rax.ini (100%) rename {plugins => contrib}/inventory/rax.py (100%) rename {plugins => contrib}/inventory/serf.py (100%) rename {plugins => contrib}/inventory/softlayer.py (100%) rename {plugins => contrib}/inventory/spacewalk.py (100%) rename {plugins => contrib}/inventory/ssh_config.py (100%) rename {plugins => contrib}/inventory/vagrant.py (100%) rename {plugins => contrib}/inventory/vbox.py (100%) rename {plugins => contrib}/inventory/vmware.ini (100%) rename {plugins => contrib}/inventory/vmware.py (100%) rename {plugins => contrib}/inventory/windows_azure.ini (100%) rename {plugins => contrib}/inventory/windows_azure.py (100%) rename {plugins => contrib}/inventory/zabbix.ini (100%) rename {plugins => contrib}/inventory/zabbix.py (100%) rename {plugins => contrib}/inventory/zone.py (100%) create mode 100644 lib/ansible/plugins/callback/log_plays.py rename {plugins/callbacks => lib/ansible/plugins/callback}/osx_say.py (54%) rename {plugins/callbacks => lib/ansible/plugins/callback}/syslog_json.py (72%) delete mode 100644 plugins/README.md delete mode 100644 plugins/callbacks/log_plays.py diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 00000000000..dab0da4ba72 --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,17 @@ +inventory +========= + +Inventory scripts allow you to store your hosts, groups, and variables in any way +you like. Examples include discovering inventory from EC2 or pulling it from +Cobbler. These could also be used to interface with LDAP or database. + +chmod +x an inventory plugin and either name it /etc/ansible/hosts or use ansible +with -i to designate the path to the script. You might also need to copy a configuration +file with the same name and/or set environment variables, the scripts or configuration +files have more details. + +contributions welcome +===================== + +Send in pull requests to add plugins of your own. The sky is the limit! + diff --git a/plugins/inventory/abiquo.ini b/contrib/inventory/abiquo.ini similarity index 100% rename from plugins/inventory/abiquo.ini rename to contrib/inventory/abiquo.ini diff --git a/plugins/inventory/abiquo.py b/contrib/inventory/abiquo.py similarity index 100% rename from plugins/inventory/abiquo.py rename to contrib/inventory/abiquo.py diff --git a/plugins/inventory/apache-libcloud.py b/contrib/inventory/apache-libcloud.py similarity index 100% rename from plugins/inventory/apache-libcloud.py rename to contrib/inventory/apache-libcloud.py diff --git a/plugins/inventory/cloudstack.ini b/contrib/inventory/cloudstack.ini similarity index 100% rename from plugins/inventory/cloudstack.ini rename to contrib/inventory/cloudstack.ini diff --git a/plugins/inventory/cloudstack.py b/contrib/inventory/cloudstack.py similarity index 100% rename from plugins/inventory/cloudstack.py rename to contrib/inventory/cloudstack.py diff --git a/plugins/inventory/cobbler.ini b/contrib/inventory/cobbler.ini similarity index 100% rename from plugins/inventory/cobbler.ini rename to contrib/inventory/cobbler.ini diff --git a/plugins/inventory/cobbler.py b/contrib/inventory/cobbler.py similarity index 100% rename from plugins/inventory/cobbler.py rename to contrib/inventory/cobbler.py diff --git a/plugins/inventory/collins.ini b/contrib/inventory/collins.ini similarity index 100% rename from plugins/inventory/collins.ini rename to contrib/inventory/collins.ini diff --git a/plugins/inventory/collins.py b/contrib/inventory/collins.py similarity index 100% rename from plugins/inventory/collins.py rename to contrib/inventory/collins.py diff --git a/plugins/inventory/consul.ini b/contrib/inventory/consul.ini similarity index 100% rename from plugins/inventory/consul.ini rename to contrib/inventory/consul.ini diff --git a/plugins/inventory/consul_io.py b/contrib/inventory/consul_io.py similarity index 100% rename from plugins/inventory/consul_io.py rename to contrib/inventory/consul_io.py diff --git a/plugins/inventory/digital_ocean.ini b/contrib/inventory/digital_ocean.ini similarity index 100% rename from plugins/inventory/digital_ocean.ini rename to contrib/inventory/digital_ocean.ini diff --git a/plugins/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py similarity index 100% rename from plugins/inventory/digital_ocean.py rename to contrib/inventory/digital_ocean.py diff --git a/plugins/inventory/docker.py b/contrib/inventory/docker.py similarity index 100% rename from plugins/inventory/docker.py rename to contrib/inventory/docker.py diff --git a/plugins/inventory/docker.yml b/contrib/inventory/docker.yml similarity index 100% rename from plugins/inventory/docker.yml rename to contrib/inventory/docker.yml diff --git a/plugins/inventory/ec2.ini b/contrib/inventory/ec2.ini similarity index 100% rename from plugins/inventory/ec2.ini rename to contrib/inventory/ec2.ini diff --git a/plugins/inventory/ec2.py b/contrib/inventory/ec2.py similarity index 100% rename from plugins/inventory/ec2.py rename to contrib/inventory/ec2.py diff --git a/plugins/inventory/fleet.py b/contrib/inventory/fleet.py similarity index 100% rename from plugins/inventory/fleet.py rename to contrib/inventory/fleet.py diff --git a/plugins/inventory/freeipa.py b/contrib/inventory/freeipa.py similarity index 100% rename from plugins/inventory/freeipa.py rename to contrib/inventory/freeipa.py diff --git a/plugins/inventory/gce.ini b/contrib/inventory/gce.ini similarity index 100% rename from plugins/inventory/gce.ini rename to contrib/inventory/gce.ini diff --git a/plugins/inventory/gce.py b/contrib/inventory/gce.py similarity index 100% rename from plugins/inventory/gce.py rename to contrib/inventory/gce.py diff --git a/plugins/inventory/jail.py b/contrib/inventory/jail.py similarity index 100% rename from plugins/inventory/jail.py rename to contrib/inventory/jail.py diff --git a/plugins/inventory/landscape.py b/contrib/inventory/landscape.py similarity index 100% rename from plugins/inventory/landscape.py rename to contrib/inventory/landscape.py diff --git a/plugins/inventory/libcloud.ini b/contrib/inventory/libcloud.ini similarity index 100% rename from plugins/inventory/libcloud.ini rename to contrib/inventory/libcloud.ini diff --git a/plugins/inventory/libvirt_lxc.py b/contrib/inventory/libvirt_lxc.py similarity index 100% rename from plugins/inventory/libvirt_lxc.py rename to contrib/inventory/libvirt_lxc.py diff --git a/plugins/inventory/linode.ini b/contrib/inventory/linode.ini similarity index 100% rename from plugins/inventory/linode.ini rename to contrib/inventory/linode.ini diff --git a/plugins/inventory/linode.py b/contrib/inventory/linode.py similarity index 100% rename from plugins/inventory/linode.py rename to contrib/inventory/linode.py diff --git a/plugins/inventory/nova.ini b/contrib/inventory/nova.ini similarity index 100% rename from plugins/inventory/nova.ini rename to contrib/inventory/nova.ini diff --git a/plugins/inventory/nova.py b/contrib/inventory/nova.py similarity index 100% rename from plugins/inventory/nova.py rename to contrib/inventory/nova.py diff --git a/plugins/inventory/openshift.py b/contrib/inventory/openshift.py similarity index 100% rename from plugins/inventory/openshift.py rename to contrib/inventory/openshift.py diff --git a/plugins/inventory/openstack.py b/contrib/inventory/openstack.py similarity index 100% rename from plugins/inventory/openstack.py rename to contrib/inventory/openstack.py diff --git a/plugins/inventory/openstack.yml b/contrib/inventory/openstack.yml similarity index 100% rename from plugins/inventory/openstack.yml rename to contrib/inventory/openstack.yml diff --git a/plugins/inventory/ovirt.ini b/contrib/inventory/ovirt.ini similarity index 100% rename from plugins/inventory/ovirt.ini rename to contrib/inventory/ovirt.ini diff --git a/plugins/inventory/ovirt.py b/contrib/inventory/ovirt.py similarity index 100% rename from plugins/inventory/ovirt.py rename to contrib/inventory/ovirt.py diff --git a/plugins/inventory/rax.ini b/contrib/inventory/rax.ini similarity index 100% rename from plugins/inventory/rax.ini rename to contrib/inventory/rax.ini diff --git a/plugins/inventory/rax.py b/contrib/inventory/rax.py similarity index 100% rename from plugins/inventory/rax.py rename to contrib/inventory/rax.py diff --git a/plugins/inventory/serf.py b/contrib/inventory/serf.py similarity index 100% rename from plugins/inventory/serf.py rename to contrib/inventory/serf.py diff --git a/plugins/inventory/softlayer.py b/contrib/inventory/softlayer.py similarity index 100% rename from plugins/inventory/softlayer.py rename to contrib/inventory/softlayer.py diff --git a/plugins/inventory/spacewalk.py b/contrib/inventory/spacewalk.py similarity index 100% rename from plugins/inventory/spacewalk.py rename to contrib/inventory/spacewalk.py diff --git a/plugins/inventory/ssh_config.py b/contrib/inventory/ssh_config.py similarity index 100% rename from plugins/inventory/ssh_config.py rename to contrib/inventory/ssh_config.py diff --git a/plugins/inventory/vagrant.py b/contrib/inventory/vagrant.py similarity index 100% rename from plugins/inventory/vagrant.py rename to contrib/inventory/vagrant.py diff --git a/plugins/inventory/vbox.py b/contrib/inventory/vbox.py similarity index 100% rename from plugins/inventory/vbox.py rename to contrib/inventory/vbox.py diff --git a/plugins/inventory/vmware.ini b/contrib/inventory/vmware.ini similarity index 100% rename from plugins/inventory/vmware.ini rename to contrib/inventory/vmware.ini diff --git a/plugins/inventory/vmware.py b/contrib/inventory/vmware.py similarity index 100% rename from plugins/inventory/vmware.py rename to contrib/inventory/vmware.py diff --git a/plugins/inventory/windows_azure.ini b/contrib/inventory/windows_azure.ini similarity index 100% rename from plugins/inventory/windows_azure.ini rename to contrib/inventory/windows_azure.ini diff --git a/plugins/inventory/windows_azure.py b/contrib/inventory/windows_azure.py similarity index 100% rename from plugins/inventory/windows_azure.py rename to contrib/inventory/windows_azure.py diff --git a/plugins/inventory/zabbix.ini b/contrib/inventory/zabbix.ini similarity index 100% rename from plugins/inventory/zabbix.ini rename to contrib/inventory/zabbix.ini diff --git a/plugins/inventory/zabbix.py b/contrib/inventory/zabbix.py similarity index 100% rename from plugins/inventory/zabbix.py rename to contrib/inventory/zabbix.py diff --git a/plugins/inventory/zone.py b/contrib/inventory/zone.py similarity index 100% rename from plugins/inventory/zone.py rename to contrib/inventory/zone.py diff --git a/lib/ansible/plugins/callback/log_plays.py b/lib/ansible/plugins/callback/log_plays.py new file mode 100644 index 00000000000..65036e6763b --- /dev/null +++ b/lib/ansible/plugins/callback/log_plays.py @@ -0,0 +1,85 @@ +# (C) 2012, Michael DeHaan, + +# 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 . + +import os +import time +import json + +from ansible.plugins.callback import CallbackBase + +# NOTE: in Ansible 1.2 or later general logging is available without +# this plugin, just set ANSIBLE_LOG_PATH as an environment variable +# or log_path in the DEFAULTS section of your ansible configuration +# file. This callback is an example of per hosts logging for those +# that want it. + + +class CallbackModule(CallbackBase): + """ + logs playbook results, per host, in /var/log/ansible/hosts + """ + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'notification' + + TIME_FORMAT="%b %d %Y %H:%M:%S" + MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n" + + def __init__(self, display): + + super(CallbackModule, self).__init__(display) + + if not os.path.exists("/var/log/ansible/hosts"): + os.makedirs("/var/log/ansible/hosts") + + def log(self, host, category, data): + if type(data) == dict: + if 'verbose_override' in data: + # avoid logging extraneous data from facts + data = 'omitted' + else: + data = data.copy() + invocation = data.pop('invocation', None) + data = json.dumps(data) + if invocation is not None: + data = json.dumps(invocation) + " => %s " % data + + path = os.path.join("/var/log/ansible/hosts", host) + now = time.strftime(self.TIME_FORMAT, time.localtime()) + fd = open(path, "a") + fd.write(self.MSG_FORMAT % dict(now=now, category=category, data=data)) + fd.close() + + def runner_on_failed(self, host, res, ignore_errors=False): + self.log(host, 'FAILED', res) + + def runner_on_ok(self, host, res): + self.log(host, 'OK', res) + + def runner_on_skipped(self, host, item=None): + self.log(host, 'SKIPPED', '...') + + def runner_on_unreachable(self, host, res): + self.log(host, 'UNREACHABLE', res) + + def runner_on_async_failed(self, host, res, jid): + self.log(host, 'ASYNC_FAILED', res) + + def playbook_on_import_for_host(self, host, imported_file): + self.log(host, 'IMPORTED', imported_file) + + def playbook_on_not_import_for_host(self, host, missing_file): + self.log(host, 'NOTIMPORTED', missing_file) diff --git a/plugins/callbacks/osx_say.py b/lib/ansible/plugins/callback/osx_say.py similarity index 54% rename from plugins/callbacks/osx_say.py rename to lib/ansible/plugins/callback/osx_say.py index 174a03300f1..bb785b3872f 100644 --- a/plugins/callbacks/osx_say.py +++ b/lib/ansible/plugins/callback/osx_say.py @@ -19,87 +19,69 @@ import subprocess import os +from ansible.plugins.callback import CallbackBase + FAILED_VOICE="Zarvox" REGULAR_VOICE="Trinoids" HAPPY_VOICE="Cellos" LASER_VOICE="Princess" SAY_CMD="/usr/bin/say" -def say(msg, voice): - subprocess.call([SAY_CMD, msg, "--voice=%s" % (voice)]) - -class CallbackModule(object): +class CallbackModule(CallbackBase): """ makes Ansible much more exciting on OS X. """ - def __init__(self): + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'notification' + + def __init__(self, display): + + super(CallbackModule, self).__init__(display) + # plugin disable itself if say is not present # ansible will not call any callback if disabled is set to True if not os.path.exists(SAY_CMD): self.disabled = True - print "%s does not exist, plugin %s disabled" % \ - (SAY_CMD, os.path.basename(__file__)) + self._display.warning("%s does not exist, plugin %s disabled" % (SAY_CMD, os.path.basename(__file__)) ) - def on_any(self, *args, **kwargs): - pass + def say(self, msg, voice): + subprocess.call([SAY_CMD, msg, "--voice=%s" % (voice)]) def runner_on_failed(self, host, res, ignore_errors=False): - say("Failure on host %s" % host, FAILED_VOICE) + self.say("Failure on host %s" % host, FAILED_VOICE) def runner_on_ok(self, host, res): - say("pew", LASER_VOICE) + self.say("pew", LASER_VOICE) def runner_on_skipped(self, host, item=None): - say("pew", LASER_VOICE) + self.say("pew", LASER_VOICE) def runner_on_unreachable(self, host, res): - say("Failure on host %s" % host, FAILED_VOICE) - - def runner_on_no_hosts(self): - pass - - def runner_on_async_poll(self, host, res, jid, clock): - pass + self.say("Failure on host %s" % host, FAILED_VOICE) def runner_on_async_ok(self, host, res, jid): - say("pew", LASER_VOICE) + self.say("pew", LASER_VOICE) def runner_on_async_failed(self, host, res, jid): - say("Failure on host %s" % host, FAILED_VOICE) + self.say("Failure on host %s" % host, FAILED_VOICE) def playbook_on_start(self): - say("Running Playbook", REGULAR_VOICE) + self.say("Running Playbook", REGULAR_VOICE) def playbook_on_notify(self, host, handler): - say("pew", LASER_VOICE) - - def playbook_on_no_hosts_matched(self): - pass - - def playbook_on_no_hosts_remaining(self): - pass + self.say("pew", LASER_VOICE) def playbook_on_task_start(self, name, is_conditional): if not is_conditional: - say("Starting task: %s" % name, REGULAR_VOICE) + self.say("Starting task: %s" % name, REGULAR_VOICE) else: - say("Notifying task: %s" % name, REGULAR_VOICE) - - def playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): - pass + self.say("Notifying task: %s" % name, REGULAR_VOICE) def playbook_on_setup(self): - say("Gathering facts", REGULAR_VOICE) - - def playbook_on_import_for_host(self, host, imported_file): - pass - - def playbook_on_not_import_for_host(self, host, missing_file): - pass + self.say("Gathering facts", REGULAR_VOICE) def playbook_on_play_start(self, name): - say("Starting play: %s" % name, HAPPY_VOICE) + self.say("Starting play: %s" % name, HAPPY_VOICE) def playbook_on_stats(self, stats): - say("Play complete", HAPPY_VOICE) - + self.say("Play complete", HAPPY_VOICE) diff --git a/plugins/callbacks/syslog_json.py b/lib/ansible/plugins/callback/syslog_json.py similarity index 72% rename from plugins/callbacks/syslog_json.py rename to lib/ansible/plugins/callback/syslog_json.py index 2e339e96aeb..978a4d719af 100644 --- a/plugins/callbacks/syslog_json.py +++ b/lib/ansible/plugins/callback/syslog_json.py @@ -6,7 +6,9 @@ import logging.handlers import socket -class CallbackModule(object): +from ansible.plugins.callback import CallbackBase + +class CallbackModule(CallbackBase): """ logs ansible-playbook and ansible runs to a syslog server in json format make sure you have in ansible.cfg: @@ -17,8 +19,13 @@ class CallbackModule(object): SYSLOG_SERVER (optional): defaults to localhost SYSLOG_PORT (optional): defaults to 514 """ + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'aggregate' + + def __init__(self, display): + + super(CallbackModule, self).__init__(display) - def __init__(self): self.logger = logging.getLogger('ansible logger') self.logger.setLevel(logging.DEBUG) @@ -30,8 +37,6 @@ class CallbackModule(object): self.logger.addHandler(self.handler) self.hostname = socket.gethostname() - def on_any(self, *args, **kwargs): - pass def runner_on_failed(self, host, res, ignore_errors=False): self.logger.error('%s ansible-command: task execution FAILED; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) @@ -45,47 +50,11 @@ class CallbackModule(object): def runner_on_unreachable(self, host, res): self.logger.error('%s ansible-command: task execution UNREACHABLE; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) - def runner_on_no_hosts(self): - pass - - def runner_on_async_poll(self, host, res): - pass - - def runner_on_async_ok(self, host, res): - pass - def runner_on_async_failed(self, host, res): self.logger.error('%s ansible-command: task execution FAILED; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) - def playbook_on_start(self): - pass - - def playbook_on_notify(self, host, handler): - pass - - def playbook_on_no_hosts_matched(self): - pass - - def playbook_on_no_hosts_remaining(self): - pass - - def playbook_on_task_start(self, name, is_conditional): - pass - - def playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): - pass - - def playbook_on_setup(self): - pass - def playbook_on_import_for_host(self, host, imported_file): self.logger.info('%s ansible-command: playbook IMPORTED; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) def playbook_on_not_import_for_host(self, host, missing_file): self.logger.info('%s ansible-command: playbook NOT IMPORTED; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) - - def playbook_on_play_start(self, name): - pass - - def playbook_on_stats(self, stats): - pass diff --git a/plugins/README.md b/plugins/README.md deleted file mode 100644 index 8d705372a51..00000000000 --- a/plugins/README.md +++ /dev/null @@ -1,35 +0,0 @@ -ansible-plugins -=============== - -You can extend ansible with optional callback and connection plugins. - -callbacks -========= - -Callbacks can be used to add logging or monitoring capability, or just make -interesting sound effects. - -Drop callback plugins in your ansible/lib/callback_plugins/ directory. - -connections -=========== - -Connection plugins allow ansible to talk over different protocols. - -Drop connection plugins in your ansible/lib/runner/connection_plugins/ directory. - -inventory -========= - -Inventory plugins allow you to store your hosts, groups, and variables in any way -you like. Examples include discovering inventory from EC2 or pulling it from -Cobbler. These could also be used to interface with LDAP or database. - -chmod +x an inventory plugin and either name it /etc/ansible/hosts or use ansible -with -i to designate the path to the plugin. - -contributions welcome -===================== - -Send in pull requests to add plugins of your own. The sky is the limit! - diff --git a/plugins/callbacks/log_plays.py b/plugins/callbacks/log_plays.py deleted file mode 100644 index dbe16b312c1..00000000000 --- a/plugins/callbacks/log_plays.py +++ /dev/null @@ -1,116 +0,0 @@ -# (C) 2012, Michael DeHaan, - -# 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 . - -import os -import time -import json - -# NOTE: in Ansible 1.2 or later general logging is available without -# this plugin, just set ANSIBLE_LOG_PATH as an environment variable -# or log_path in the DEFAULTS section of your ansible configuration -# file. This callback is an example of per hosts logging for those -# that want it. - -TIME_FORMAT="%b %d %Y %H:%M:%S" -MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n" - -if not os.path.exists("/var/log/ansible/hosts"): - os.makedirs("/var/log/ansible/hosts") - -def log(host, category, data): - if type(data) == dict: - if 'verbose_override' in data: - # avoid logging extraneous data from facts - data = 'omitted' - else: - data = data.copy() - invocation = data.pop('invocation', None) - data = json.dumps(data) - if invocation is not None: - data = json.dumps(invocation) + " => %s " % data - - path = os.path.join("/var/log/ansible/hosts", host) - now = time.strftime(TIME_FORMAT, time.localtime()) - fd = open(path, "a") - fd.write(MSG_FORMAT % dict(now=now, category=category, data=data)) - fd.close() - -class CallbackModule(object): - """ - logs playbook results, per host, in /var/log/ansible/hosts - """ - - def on_any(self, *args, **kwargs): - pass - - def runner_on_failed(self, host, res, ignore_errors=False): - log(host, 'FAILED', res) - - def runner_on_ok(self, host, res): - log(host, 'OK', res) - - def runner_on_skipped(self, host, item=None): - log(host, 'SKIPPED', '...') - - def runner_on_unreachable(self, host, res): - log(host, 'UNREACHABLE', res) - - def runner_on_no_hosts(self): - pass - - def runner_on_async_poll(self, host, res, jid, clock): - pass - - def runner_on_async_ok(self, host, res, jid): - pass - - def runner_on_async_failed(self, host, res, jid): - log(host, 'ASYNC_FAILED', res) - - def playbook_on_start(self): - pass - - def playbook_on_notify(self, host, handler): - pass - - def playbook_on_no_hosts_matched(self): - pass - - def playbook_on_no_hosts_remaining(self): - pass - - def playbook_on_task_start(self, name, is_conditional): - pass - - def playbook_on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None): - pass - - def playbook_on_setup(self): - pass - - def playbook_on_import_for_host(self, host, imported_file): - log(host, 'IMPORTED', imported_file) - - def playbook_on_not_import_for_host(self, host, missing_file): - log(host, 'NOTIMPORTED', missing_file) - - def playbook_on_play_start(self, name): - pass - - def playbook_on_stats(self, stats): - pass - diff --git a/setup.py b/setup.py index 1f73836cbd3..01ee94cfda0 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup(name='ansible', package_dir={ '': 'lib' }, packages=find_packages('lib'), package_data={ - '': ['module_utils/*.ps1', 'modules/core/windows/*.ps1', 'modules/extras/windows/*.ps1'], + '': ['module_utils/*.ps1', 'modules/core/windows/*.ps1', 'modules/extras/windows/*.ps1', 'contrib/README.md', 'contrib/inventory/*'], }, scripts=[ 'bin/ansible', From 0bbf5927be81183dfee128e293f269253266e402 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 20:39:16 -0400 Subject: [PATCH 09/12] added executabel bit to nova and rax inventory plugins --- contrib/inventory/nova.py | 0 contrib/inventory/rax.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 contrib/inventory/nova.py mode change 100644 => 100755 contrib/inventory/rax.py diff --git a/contrib/inventory/nova.py b/contrib/inventory/nova.py old mode 100644 new mode 100755 diff --git a/contrib/inventory/rax.py b/contrib/inventory/rax.py old mode 100644 new mode 100755 From aaad33ccb6200aeb9211199e0120ff2d1d31bf4a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 22:31:52 -0400 Subject: [PATCH 10/12] fixed a couple of bugs --- lib/ansible/plugins/callback/__init__.py | 2 +- lib/ansible/plugins/callback/syslog_json.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index e430c9b5db7..776ad15717b 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -114,7 +114,7 @@ class CallbackBase: host = result._host.get_name() #FIXME, get item to pass through item = None - self.runner_on_skipped(host, result._result, item) + self.runner_on_skipped(host, item) def v2_runner_on_unreachable(self, result): host = result._host.get_name() diff --git a/lib/ansible/plugins/callback/syslog_json.py b/lib/ansible/plugins/callback/syslog_json.py index 978a4d719af..3be64ee154c 100644 --- a/lib/ansible/plugins/callback/syslog_json.py +++ b/lib/ansible/plugins/callback/syslog_json.py @@ -45,7 +45,7 @@ class CallbackModule(CallbackBase): self.logger.info('%s ansible-command: task execution OK; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) def runner_on_skipped(self, host, item=None): - self.logger.info('%s ansible-command: task execution SKIPPED; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) + self.logger.info('%s ansible-command: task execution SKIPPED; host: %s; message: %s' % (self.hostname,host, 'skipped')) def runner_on_unreachable(self, host, res): self.logger.error('%s ansible-command: task execution UNREACHABLE; host: %s; message: %s' % (self.hostname,host,json.dumps(res, sort_keys=True))) From 42357f7f2a8000ce9848e26c0eb8fdc4bd2127fd Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 8 Jul 2015 23:55:52 -0400 Subject: [PATCH 11/12] moved contrib into manifest from setup.py --- MANIFEST.in | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index f4e727d8c4d..44aa7c07c4a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -14,5 +14,7 @@ recursive-include plugins * include Makefile include VERSION include MANIFEST.in +include contrib/README.md +include contrib/inventory * prune lib/ansible/modules/core/.git prune lib/ansible/modules/extras/.git diff --git a/setup.py b/setup.py index 01ee94cfda0..1f73836cbd3 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup(name='ansible', package_dir={ '': 'lib' }, packages=find_packages('lib'), package_data={ - '': ['module_utils/*.ps1', 'modules/core/windows/*.ps1', 'modules/extras/windows/*.ps1', 'contrib/README.md', 'contrib/inventory/*'], + '': ['module_utils/*.ps1', 'modules/core/windows/*.ps1', 'modules/extras/windows/*.ps1'], }, scripts=[ 'bin/ansible', From ebeb0b03485bd9f175fefc8492c27ce8870a16e6 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 10 Jul 2015 10:30:52 -0400 Subject: [PATCH 12/12] removed plugins dir that was removed --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 44aa7c07c4a..8af0aa9bc17 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,7 +10,6 @@ include examples/ansible.cfg include lib/ansible/module_utils/powershell.ps1 recursive-include lib/ansible/modules * recursive-include docs * -recursive-include plugins * include Makefile include VERSION include MANIFEST.in