Ansible's paths crossed in Vagrant Provision?

41 views
Skip to first unread message

Kristina Bressler

unread,
Mar 29, 2021, 1:08:16 PM3/29/21
to Vagrant
Hi,
When I started up a project with "vagrant up", everything was fine. But when I typed in "vagrant provision", I encountered this error:
`System info:
  Ansible 2.7.1; Vagrant 2.2.14; Darwin
  Trellis 1.0.3: April 30th, 2019
---------------------------------------------------
MODULE FAILURE
See stdout/stderr for the exact error
Traceback (most recent call last):
  File "<stdin>", line 113, in <module>
  File "<stdin>", line 105, in _ansiballz_main
  File "<stdin>", line 48, in invoke_module
  File "/usr/lib/python3.6/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.6/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 618, in _exec
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
  File "/tmp/ansible_setup_payload_1p7_kmoy/__main__.py", line 127, in
<module>
ImportError: attempted relative import with no known parent package

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: attempted relative import with no known parent package
fatal: [default]: FAILED! => {"changed": false, "module_stdout": "", "rc": 1}
to retry, use: --limit @/Users/kiki/Code/project/trellis/dev.retry

PLAY RECAP *********************************************************************
default                    : ok=2    changed=0    unreachable=0    failed=1

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 78 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.`

I looked in my folders at /usr/lib/ and I don't see python3 folder in this location. I can only find python2.7 folder. I even ran brew install python to install the latest version and I can see that it's downloading to /usr/local/lib/ where I can see two folders, python2.7 and python3.9.

So the conclusion I got was that Ansible was trying to find python3 in wrong folder? So I think I have 2 options:

  1. try to brew install python in /usr/lib
  2. try to fix the Ansible's path to point to or find in usr/local/lib
  3. or copy the python3 folder from /usr/local/lib to /usr/lib

So how do I do either one of the options or which is the best/alternative option?

Do I type in the command line "ansible_python_interpreter = usr/local/lib"?

My ansible version is 2.7.1. 

My pip3 version is pip 21.0.1 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)

-Kristina

Alvaro Miranda Aguilera

unread,
Apr 3, 2021, 6:06:20 AM4/3/21
to vagra...@googlegroups.com
hello

ansible requires to be setup to make it work

you could check pyenv and setup ansible as a virtual environment

however i would suggest consider using ansible-local that will run directly  on the vm



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/e661bdd3-1cfb-4a5a-aa5a-cfc7abdd8a55n%40googlegroups.com.


--
Alvaro

Reply all
Reply to author
Forward
0 new messages