Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Cask installs that require a password fail #3415

Closed
edrozenberg opened this issue Nov 10, 2016 · 7 comments
Closed

Cask installs that require a password fail #3415

edrozenberg opened this issue Nov 10, 2016 · 7 comments

Comments

@edrozenberg
Copy link

edrozenberg commented Nov 10, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

homebrew_cask

ANSIBLE VERSION
ansible 2.2.0.0
  config file = 
  configured module search path = Default w/o overrides
CONFIGURATION
[defaults]
inventory             = hosts/hosts
vault_password_file   = ~/.ansible/vault/password.txt
retry_files_enabled   = False
retry_files_save_path = ~/.ansible/retry
remote_user           = root
nocows                = 0

[ssh_connection]
pipelining = True
OS / ENVIRONMENT

macOS Sierra 10.12.1 (16B2555)

One mac (controller) controlling another mac (minion) using normal ssh connection with ssh key.

SUMMARY

Some homebrew casks ask for a password during the installation process. It appears the ansible module does not provide a way to collect a password and pass it to the homebrew cask installer.

Currently, these casks that require a password need to be manually installed using 'brew cask install at the command line. Ansible cannot install them.

Found two casks so far that failed to install with Ansible, but work fine when done manually: microsoft-office and wireshark

STEPS TO REPRODUCE
- homebrew_cask: name=wireshark state=present
- homebrew_cask: name=microsoft-office state=present
EXPECTED RESULTS

wireshark cask and microsoft-office casks are installed

ACTUAL RESULTS
failed: [10.0.1.119] (item=wireshark) => {"failed": true, "item": "wireshark", "msg": "Error: Command failed to execute!\n\n==> Failed command:\n/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/wireshark/2.2.1/Wireshark 2.2.1 Intel 64.pkg> -target /\n\n==> Standard Output of failed command:\n\n\n==> Standard Error of failed command:\nsudo: no tty present and no askpass program specified\n\n\n==> Exit status of failed command:\n#<Process::Status: pid 29235 exit 1>"}
failed: [10.0.1.119] (item=microsoft-office) => {"failed": true, "item": "microsoft-office", "msg": "Error: Command failed to execute!\n\n==> Failed command:\n/usr/bin/sudo -E -- /usr/sbin/installer -pkg #<Pathname:/usr/local/Caskroom/microsoft-office/15.27.0_161010/Microsoft_Office_2016_15.27.0_161010_Installer.pkg> -target /\n\n==> Standard Output of failed command:\n\n\n==> Standard Error of failed command:\nsudo: no tty present and no askpass program specified\n\n\n==> Exit status of failed command:\n#<Process::Status: pid 12059 exit 1>"}
@edrozenberg
Copy link
Author

edrozenberg commented Nov 10, 2016

Found that the issue has been discussed on homebrew cask, puppet, chef projects already:
Homebrew/homebrew-cask#5667
boxen/puppet-brewcask#22
kitchenplan/chef-homebrewalt#8

Some suggestions are to use sudo, but that would make the entire app owned by root instead of the regular user. Not sure if the issue needs to be tackled by the Ansible cask module or the homebrew cask project.

@ansibot
Copy link

ansibot commented Nov 10, 2016

@indrajitr, ping. This issue is waiting on your response.
click here for bot help

@bcg62
Copy link

bcg62 commented Nov 10, 2016

sous-chefs/homebrew#111

@rqelibari
Copy link

rqelibari commented Nov 24, 2016

You can currently circumvent this by doing it like this:

- name: "Run this task before homebrew_cask module, so that sudo cache gets refreshed."
  command: "echo none"
  become: yes

- name: "Install casks."
  homebrew_cask: name={{package}} state=present
  with_items: "{{ your_cask_apps_which_need_admin_rights }}"
  ignore_errors: yes
  loop_control:
     loop_var: package

What this actually does is nothing else then sudo -v does in bash scripts. And as such homebrew-cask will not ask you for a password.

@ansibot
Copy link

ansibot commented Nov 25, 2016

@indrajitr, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Dec 7, 2016

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

@ansibot
Copy link

ansibot commented Sep 11, 2017

This issue was migrated to ansible/ansible#29403

@ansibot ansibot closed this as completed Sep 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants