-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Dock Command does not install correctly, causing the dock commands to skip #79
Comments
I also have the same issue. It seems that the install step when run by ansible downloads dockutil to |
@gregorskii I think I've figured it out. When installing homebrew casks via the homebrew role, the sudo password is specified as an ansible variable. - name: Install configured cask applications.
homebrew_cask:
name: "{{ item.name | default(item) }}"
state: present
install_options: "{{ item.install_options | default('appdir=' + homebrew_cask_appdir) }}"
accept_external_apps: "{{ homebrew_cask_accept_external_apps }}"
sudo_password: "{{ ansible_become_password | default(omit) }}"
loop: "{{ homebrew_cask_apps }}"
notify:
- Clear homebrew cache However, when using the dock role to install dockutil, no sudo password is specified. - name: Install dockutil.
community.general.homebrew_cask:
name: "{{ dockutil_homebrew_cask }}"
state: present
notify:
- Clear homebrew cache
when: dockutil_install
tags: ['dock']
When I first attempt to run the playbook with dockutil tasks on a remote machine, it hangs on the install step (presumably waiting for a sudo password that never gets inputted.
When I log into the remote machine locally, I see that homebrew shows dockutil as installed, but running dockutil results in "command not found" indicating that homebrew didn't finish installing it. (Presumably because the first run hung up on the sudo password step.) If I uninstall and reinstall dockutil on the machine locally and input the sudo password, then the dock role runs correctly. So, I think the workaround here is to install dockutil by adding it to |
Wanted to provide an update, I forked the repo and tried to add the sudo_password option and for the life of me I cannot get it to work. It either still prompts for the password even when specifying --ask-become-pass, if I add ansible_become_password via a lookup it will install but it won't actually create the /usr/local/bin/dockutil entry. However putting in the homebrew_cask_apps variable and running the homebrew role like @supercoffee said it works just fine. |
Took a break and I came back and compared the homebrew code again and noticed there was a become option in the block that was being executed. I have submitted PR #84 to fix it as long with a sleep for dock position settings. Original Code: - name: Install dockutil.
community.general.homebrew_cask:
name: "{{ dockutil_homebrew_cask }}"
state: present
notify:
- Clear homebrew cache
when: dockutil_install
tags: ['dock'] Updated code - name: Install dockutil
become: "{{ (homebrew_user != ansible_user_id) | bool }}"
become_user: "{{ homebrew_user }}"
community.general.homebrew_cask:
name: "{{ dockutil_homebrew_cask }}"
state: present
notify:
- Clear homebrew cache
when: dockutil_install
tags: ['dock'] I still don't fully understand why this works fine but it does. |
It looks like pathfinding is a little different for Casks and normal brew utils. Today, I'm interested in local setup and I don't follow geerlingguy/mac-dev-playbook where Jeff installs I've ended up with:
- name: Ensure .zprofile exists
copy:
content: ""
dest: "/Users/{{ lookup('env', 'USER') }}/.zprofile"
force: no
- name: Ensure brew path in ~/.zprofile
lineinfile:
state: present
path: "/Users/{{ lookup('env', 'USER') }}/.zprofile"
line: eval "$({{ (ansible_machine == 'arm64') | ternary('/opt/homebrew', '/usr/local') }}/bin/brew shellenv)"
tags: ['homebrew'] or a shell script echo "Installing brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Updating ~/.zprofile ..."
if [[ "$(uname -m)" == "arm64" ]]
then
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> "${HOME}/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> "${HOME}/.zprofile"
eval "$(/usr/local/bin/brew shellenv)"
fi |
I ran into a similar issue (dockutils are not working with the dock role). I've installed brew manually on the Mac, including setting the Running a playbook remotely with the dock role fails with this error:
My workaround: Adding the homebrew paths manually to the PATH variable:
|
I am finding that installing the fork of the brew package does not work on my machine as it seems to require the sudo password to link correctly. I have to remote desktop into the node uninstall the dockutil command and reinstall it with interactivity, when I do tha it prompts for my password and installs correctly.
Any ideas? Anyone experiencing this?
The text was updated successfully, but these errors were encountered: