pkaramol
pkaramol

Reputation: 19422

ansible: AnsibleModule.log() method does not print anything to stdout/stderr

I am trying to write a custom ansible module.

I need to have some debug info during module execution.

However the following lines fo not print anything even with the highest verbosity level enabled (-vvvv) and with export ANSIBLE_DEBUG=true

from ansible.module_utils.basic import AnsibleModule

module.log(msg="some_message"))

The only time I am ever able to see some msg printed is via the following method:

module.exit_json(changed=True, msg=_msg)

Upvotes: 0

Views: 1851

Answers (1)

pkaramol
pkaramol

Reputation: 19422

It should be emphasized that AnsibleModule.log() will not send the output to neither stout or stderr. It will send it to the default system logging facility.

In my case this was /var/log/syslog.

Upvotes: 1

Related Questions