Open rot26 opened 8 years ago
which version of dopy did you install on the target machine(s)?
Hi @kontrafiktion,
I am running dopy-0.3.7
on my mac (el capitan) 10.11.6. I tried both python2.7 and python3.5 using pip 8.1.2
As I understand it, ansible is using dopy for the digital ocean api wrapper to create the machines, so I do not have dopy installed on those target machines, only my main command and control machine.
Your playbook above says hosts: digitalocean
... Do you have dopy installed on that machine? And you might want to try dopy-0.3.7a
Ah, I totally forgot: you might need to add the following to the 'digitalocean' declaration in inventory:
ansible_python_interpreter=python
See https://github.com/ansible/ansible-modules-core/issues/2509#issuecomment-170256077
Ok, this has been working fine for me for most of the year .. now something has upgraded and I'm getting;
NameError: name 'DoError' is not defined
I've tried messing with different versions of dopy from 0.3.5 to 0.3.7.a, doesn't seem to make any difference, and I've tried adding the other suggested options, but nothing seems to make a difference. This seems like a pretty fundamental issue - does anyone have a fix?
Looking at "digital_ocean.py", it's failing to find "dopy", even though I've checked the executable running is /usr/bin/python, and /usr/bin/python can import "dopy" fine from the command prompt. Is Ansible / digital_ocean messing with the import path?
Mmm, not helpful. If you mean add th ansible_python_interpreter, yes, done that - no difference. If you mean try 0.3.7a, yes, done that too. I've inserted code to check the executable is what it should be, and I've tried removing some "try" blocks to clarify the error. For some reason it thinks "dopy" is not a module when it clearly is.
I only have seen this error, when the target machine on which Ansible is executing the playbook does not have dopy installed for the "python" that is used by Ansible.
1) What is the "host" used in your playbook? localhost? Ideally post a minimal playbook.
2) If you open a python shell on that host (with the python indicated by ansible_python_interpreter
: does "import dopy" work?
I'm a little past that .. I'm messing around with "digital_ocean.py", from what I can see there's some sort of virtual environment or chrooting going on, which is bizarre. If I get digital_ocean.py to print out some stuff just before it bails, it confirms both the executable and the PYTHONPATH stuff is correct, but if I use "walk" to list the contents of the folder that should contain "dopy", it's just not there .. whereas outside of the program it IS there .. so as far as I can see it's not a function of the Python binary in use - it's an issue with the binary being able to "see" the folders it's modules are in. Will investigate further.
Ok, ignore me - something has removed "dopy" from my live server, I think I'm looking for the problem in the wrong place ...
Ok, fixed by adding (-e 'ansible_python_interpreter=pypy') to the Ansible command line .. I think I can see what the issue "is", the development box is running Ansible using cpython, while the deployment server is using pypy .. but this has always been the case (or so I thought) and it's been working daily ... I need to work out what changed ..
Greetings @zbal ,
I am hitting an issue with dopy where it throws a
NameError: name 'DoError' is not defined
.Here is what I am doing...
Playbook: 'digitalocean.yml'
Running ansible playbook in verbose mode:
The next line shows this Error:
I am not sure how to debug this further. Any suggestions? Cheers!