Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure proper ownership fails for apps with admin as group #95

Open
flmmartins opened this issue Mar 15, 2024 · 1 comment
Open

Ensure proper ownership fails for apps with admin as group #95

flmmartins opened this issue Mar 15, 2024 · 1 comment

Comments

@flmmartins
Copy link

I am using the following variables:

homebrew_cask_accept_external_apps: true

I installed 1password manually with brew install --cask and when running the playbook I got the error below.

This happens because 1password has very strict permissions I think because it group is admin. If I set the variable homebrew_group: admin that causes errors with other apps.

What can I do to solve this? Tks!

TASK [geerlingguy.mac.homebrew : Ensure proper ownership on homebrew_install_path subdirs.] ************************************************************************************************************************************************************************************
task path: /Users/f.martins/.ansible/collections/ansible_collections/geerlingguy/mac/roles/homebrew/tasks/main.yml:67
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: f.martins
<127.0.0.1> EXEC /bin/sh -c 'echo ~f.martins && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /Users/f.martins/.ansible/tmp"&& mkdir "echo /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839" && echo ansible-tmp-1710511744.447911-10861-45730543567839="echo /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839" ) && sleep 0'
Using module file /Users/f.martins/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ansible/modules/file.py
<127.0.0.1> PUT /Users/f.martins/.ansible/tmp/ansible-local-10644bz6g8eyl/tmp7y4x49l9 TO /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839/AnsiballZ_file.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839/ /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839/AnsiballZ_file.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=akchneghgvycbzsyhadmhjbdzdmqrtly] password:" -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-akchneghgvycbzsyhadmhjbdzdmqrtly ; /Users/f.martins/.pyenv/versions/3.12.2/bin/python3.12 /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839/AnsiballZ_file.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/f.martins/.ansible/tmp/ansible-tmp-1710511744.447911-10861-45730543567839/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
File "/tmp/ansible_file_payload_l5kb94a5/ansible_file_payload.zip/ansible/module_utils/basic.py", line 860, in set_group_if_different
os.lchown(b_path, -1, gid)
fatal: [127.0.0.1]: FAILED! => {
"changed": false,
"gid": 80,
"group": "admin",
"invocation": {
"module_args": {
"_diff_peek": null,
"_original_basename": null,
"access_time": null,
"access_time_format": "%Y%m%d%H%M.%S",
"attributes": null,
"follow": true,
"force": false,
"group": "20",
"mode": null,
"modification_time": null,
"modification_time_format": "%Y%m%d%H%M.%S",
"owner": "f.martins",
"path": "/opt/homebrew",
"recurse": true,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "directory",
"unsafe_writes": false
}
},
"mode": "0755",
"msg": "chgrp failed",
"owner": "f.martins",
"path": "/Applications/1Password.app/Contents",
"size": 384,
"state": "directory",
"uid": 501
}

@flmmartins flmmartins changed the title Ensure proper ownership fails for apps with set as admin group Ensure proper ownership fails for apps with admin as group Mar 15, 2024
@LymanBE
Copy link

LymanBE commented Apr 7, 2024

I think some combination of the following two commands finally fixed this same issue for me. I'm not sure if only the second command was necessary, but I ran them both. The first was insufficient on its own, but after the cleanup I was then able to install packages.

sudo chown -R $(whoami) /opt/homebrew
brew cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants