You should not need to run ansible as root, nor should you have other
administrative privileges for running it.
Also the installation with pip should not need root/admin:
Follow 
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip

On Mon, 7 Aug 2023 at 16:45, dmastrop <[email protected]> wrote:
>
> 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 <module>
>
>     import ansible.constants as C
>
>   File 
> "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible/constants.py",
>  line 181, in <module>
>
>     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
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/0f41a82e-cf87-4290-b9c3-487ba54821c2n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLbQMHF6bipCAgE1hdO0Yr5wkhQw%2BMtNywZYRMdB5e1iFw%40mail.gmail.com.

Reply via email to