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

Certain homebrew casks hang instead of copying themselves to /Applications #31

Closed
maspotts opened this issue Dec 22, 2021 · 2 comments
Closed

Comments

@maspotts
Copy link

I'm successfully installing homebrew formulae and casks on a mac (with 12.1 Monterey); but certain casks hang after installing themselves into the remote /opt/brew/Caskroom, but before being copied into /Applications. Those same casks install properly via ssh (without ansible). These casks include: google-drive, expressvpn; I imagine there will be others. As an example:

- name: Install vpn
  homebrew_cask:
    name:
      - expressvpn
    state: present

This will hang ansible-galaxy. If I interrupt and check the system I see that /opt/brew/Caskroom/expressvpn exists and contains the expected files and subdirectories, but /Applications/ExpressVPN does not exist. If I ssh to the system and execute: brew install expressvpn then it complains that the cask is already installed. If I execute brew reinstall expressvpn (or brew uninstall expressvpn && brew reinstall expressvpn) then it succeeds. I am not challenged for my password during the manual (ssh) install process. I can't figure out where to look for logs to diagnose the problem further; ansible-galaxy -vvv just shows:

<zen> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="mike"' -o ConnectTimeout=10 -o ControlPath=/Users/mike/.ansible/cp/a545970042 -tt zen '/bin/sh -c '"'"'/Users/mike/.pyenv/shims/python3.9 /Users/mike/.ansible/tmp/ansible-tmp-1640213431.403431-98216-257073436789997/AnsiballZ_homebrew_cask.py && sleep 0'"'"''

Any ideas? For now I'm having to comment out the affected casks, but this is the only part of my entire mac setup that's not working at this point, and I must be doing something stupid.

@maspotts
Copy link
Author

I just realised that the expressvpn install does prompt for the sudo password; I was thus able to get my play to execute by supplying the password on the command-line (-e "ansible_become_password=XXXXX") and then forwarding it to the homebrew_cask module via sudo_password: "{{ ansible_become_password }}". This works, so I guess I should close this issue. But it's not very elegant, because I'm already supplying the sudo password interactively via --ask-become-pass and yet I can't find any way to pass that value to the homebrew_cask module (sudo_password: "{{ what_can_I_use_here }}"). Is this truly an unsolved problem in ansible? (I know that I can also set a variable via a vault, but I don't want to do that either: I just wanted to supply the sudo password once, per invocation, by hand.). Is it possible to pass the --ask-become-pass password to homebrew_cask, either implicitly or explicitly? If not then I guess this issue is moot. Thanks in advance!

@maspotts
Copy link
Author

maspotts commented Dec 23, 2021

In case it's of any use, I realised that if I explicitly set ansible_become_pass (instead of ansible_become_password) then that variable becomes available inside the ansible environment and I no longer need to supply the --ask-become-pass argument: so my script now prompts for the password (using read -rs) once, then supplies it explicitly on the command line. Not great for security, but I'm the only user on this system so good enough I guess. Closing now.

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

1 participant