Give a module the possibility to known its own name (#16087)

* Give a module the possibility to known its own name

This is useful for logging and reporting and fixes the longstanding problem with syslog-messages:

    May 30 15:50:11 moria ansible-<stdin>: Invoked with ...

now becomes:

    Jun  1 17:32:03 moria ansible-copy: Invoked with ...

This fixes #15830

* Rename the internal name from module.ansible_module_name to module._name
This commit is contained in:
Dag Wieers 2016-06-10 17:48:54 +02:00 committed by Brian Coca
commit 04ce71b4bd
2 changed files with 12 additions and 5 deletions

View file

@ -574,6 +574,9 @@ class ActionBase(with_metaclass(ABCMeta, object)):
# give the module information about the ansible version
module_args['_ansible_version'] = __version__
# give the module information about its name
module_args['_ansible_module_name'] = module_name
# set the syslog facility to be used in the module
module_args['_ansible_syslog_facility'] = task_vars.get('ansible_syslog_facility', C.DEFAULT_SYSLOG_FACILITY)