Closed willmore closed 8 years ago
Hi @willmore @irabinovitch - having a bit of trouble with this on our buildservers, we're seeing
[WARNING]: Failure when attempting to use callback plugin (</tmp/ops_e40c9b8c-
6cbb-4018-a8f1-dc79e85b6a80/ansible/playbooks/callback_plugins/datadog_callback
_ansible2.CallbackModule object at 0x7f6816d47c50>): [Errno 2] No such file or
directory
and
[WARNING]: Failure when attempting to use callback plugin (</tmp/ops_e40c9b8c-
6cbb-4018-a8f1-dc79e85b6a80/ansible/playbooks/callback_plugins/datadog_callback
_ansible2.CallbackModule object at 0x7f6816d47c50>): 'module_name'
Any ideas as to how I can even start to debug this?
Thanks @willmore , this was very helpful.
I added a few things for my personal enjoyment:
If anyone wants these, here is some code.... print statements at start:
import getpass
from os import popen
print("Datadog notifications enabled, be sure you meet these requirements: pip install datadog pyyaml && ansible > 2.0")
print("Your ansible version is:")
ansible_version_long = os.popen("ansible --version | head -n1 | awk '{print $2}'").read()
print(ansible_version_long)
exit if ansible < 2 :
ansible_version_major = int(os.popen("ansible --version | head -n1 | awk '{print $2}' | cut -d . -f 1").read())
if ansible_version_major >= 2:
... all the code stuff ....
else:
print "ansible_version >= 2.0 required for datadog notifications, remove ansible-core/callback_plugins folder to continue; there is no smooth way to handle this, sorry"
exit()
Change remote_user to shell_user:
# self._options.remote_user,
getpass.getuser(),
any update on this? almost 2 months have past and ansible 2 is gaining popularity
possible duplicate of #11 ?
Thanks @willmore!
I'm working on testing this PR (along with #11) and merging the changes into the current callback (I'd like to keep one callback file for both Ansible 1 and 2). I should have something ready by the end of the week.
cc @oryband
Closed by #16, thanks @willmore!
@olivielpeau happy to be of help. Thanks for adding the Ansible 2 support!
@joffotron i'm having a similar issue, opened a different ticket: #18
Added new file
datadog_callback_ansbile2.py
which is a copy ofdatadog_callback.py
modified to work with Ansible 2.This commit is a quick attempt to maintain Ansible 2 compatibility. The V1 version has not been modified at all, and there has been no attempt to normalize the interaction with DataDog between the two versions - a big DRY violation. However, Ansible 2 works and refactoring can be done as needed/desired.
Modification began with following porting guidance: https://docs.ansible.com/ansible/porting_guide_2.0.html
Minor other adjustments were maded following examples: https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/callback