Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`ansible --version` command throws an ERROR

Tags:

pip

ansible

Good Day guys

I have installed ansible on my mac, it was successfully installed but then when I run the command ansible --version it throws me a n error:

Unhandled error:
 Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 559, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 503, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 124, in ensure_type
    value = tempfile.mkdtemp(prefix=prefix, dir=value)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 339, in mkdtemp
    _os.mkdir(file, 0700)
OSError: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'


Traceback (most recent call last):
  File "/usr/local/bin/ansible", line 62, in <module>
    import ansible.constants as C
  File "/Library/Python/2.7/site-packages/ansible/constants.py", line 174, in <module>
    config = ConfigManager()
  File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 291, in __init__
    self.update_config_data()
  File "/Library/Python/2.7/site-packages/ansible/config/manager.py", line 571, in update_config_data
    raise AnsibleError("Invalid settings supplied for %s: %s\n" % (config, to_native(e)), orig_exc=e)
ansible.errors.AnsibleError: Invalid settings supplied for DEFAULT_LOCAL_TMP: [Errno 13] Permission denied: '/Users/patrick/.ansible/tmp/ansible-local-37505vvsQNX'

Appreciate your help guys.

like image 694
noob Avatar asked Sep 05 '25 23:09

noob


1 Answers

Check if this is similar to iiab/iiab/issue 1212:

After some more digging, I found the real source of this problem was hardcoded paths in ansible.cfg

Or the more recent ansible/galaxy-dev issue 107, which leads to PR 110:

The default ansible temp dir ~/.ansible/tmp is accessed by ansible-doc via the galaxy-importer.
This works OK in the galaxy-dev local env, but on the CI environment it attempts to create dir /.ansible/tmp and fails.

This PR changes the default ansible temp dir to /tmp/ansible which is outside the user home (and in the local env, /tmp has greater permissions)

Try and change DEFAULT_LOCAL_TMP to /tmp.

like image 115
VonC Avatar answered Sep 09 '25 19:09

VonC