hi all
I have an issue with the ansible installation on Mac.
I was able to install ansible without issue on a Cloud9 ubuntu compute instance, EC2 instances, etc, but I am having a permissions issue on the Mac.
I have to run with sudo
With sudo this is the ansibile --version
% sudo ansible --version
Password:
ansible [core 2.15.2]
config file = None
configured module search path = [‘/Users/xxxx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ansible
ansible collection location = /Users/xxxx/.ansible/collections:/usr/share/ansible/collections
executable location = /Library/Frameworks/Python.framework/Versions/3.11/bin/ansible
python version = 3.11.4 (v3.11.4:d2340ef257, Jun 6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)] (/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11)
jinja version = 3.1.2
libyaml = True
I am logged into the Mac as user xxxx with administrator privileges.
when I run the ansible version without sudo I get the following backtrace. (I don’t know why it is referencing python 3.7. It initially installed with module location of 3.7 but that was fixed and from output above it has the 3.11 module location).
% ansible --version
Unhandled error:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 605, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 543, in get_config_value_and_origin
value = ensure_type(value, defs[config].get(‘type’), origin=origin)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 124, in ensure_type
value = tempfile.mkdtemp(prefix=prefix, dir=value)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py”, line 366, in mkdtemp
_os.mkdir(file, 0o700)
PermissionError: [Errno 13] Permission denied: ‘/Users/xxxx/.ansible/tmp/ansible-local-506222opmhr9x’
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 605, in update_config_data
value, origin = self.get_config_value_and_origin(config, configfile)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 543, in get_config_value_and_origin
value = ensure_type(value, defs[config].get(‘type’), origin=origin)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 124, in ensure_type
value = tempfile.mkdtemp(prefix=prefix, dir=value)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tempfile.py”, line 366, in mkdtemp
_os.mkdir(file, 0o700)
PermissionError: [Errno 13] Permission denied: ‘/Users/xxxx/.ansible/tmp/ansible-local-506222opmhr9x’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/bin//ansible”, line 63, in
import ansible.constants as C
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/constants.py”, line 181, in
config = ConfigManager()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 310, in init
self.update_config_data()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/config/manager.py”, line 617, 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/xxxx/.ansible/tmp/ansible-local-506222opmhr9x’
. [Errno 13] Permission denied: ‘/Users/xxxx/.ansible/tmp/ansible-local-506222opmhr9x’
It seems to be an issue with this tmp directory:
‘/Users/xxxx/.ansible/tmp/ansible-local-506222opmhr9x’
I tried getting into the this tmp directory and get permission denied as it is owned by root
% ls -la
total 0
drwxr-xr-x 4 root staff 128 May 23 18:01 .
drwxr-xr-x+ 50 xxx staff 1600 Aug 3 18:08 …
drwx------ 2 root staff 64 May 23 18:02 cp
drwx------ 2 root staff 64 Aug 3 18:23 tmp
Is there a fix for this?
warm regards
Dave