geerlingguy / ansible-collection-mac

Collection of macOS automation tools for Ansible.
https://galaxy.ansible.com/geerlingguy/mac
MIT License
299 stars 113 forks source link

Sudo Issue with Cask Installed Item #102

Open allebone opened 4 months ago

allebone commented 4 months ago

When Installing Tenable Nessus Agent via Cask, Exit 1 Error Occurs.

Text Output as Follows: failed: [*REPLACEDHOSTNAME*] (item=tenable-nessus-agent) => {"ansible_loop_var": "item", "changed": false, "item": "tenable-nessus-agent", "msg": "sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\nsudo: a password is required\nError: Failure while executing;/usr/bin/sudo -u root -E LOGNAME=omni_admin USER=omni_admin USERNAME=omni_admin -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/tenable-nessus-agent/10.6.3,22994/Install\ Nessus\ Agent.pkg -target /exited with 1. Here's the output:\nsudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\nsudo: a password is required"}

Google Chrome Succeeds Install in Same Order and Config.

Attempted Install with both become:yes and without.

guruevi commented 1 month ago

Seems to be a duplicate of https://github.com/geerlingguy/ansible-role-homebrew/issues/73

The problem is that the package is requesting sudo. This is a problem with the specific package, not homebrew. There are options such as specifying SUDO_ASKPASS variable with a script that returns the password.

guruevi commented 3 weeks ago

https://docs.ansible.com/ansible/latest/collections/community/general/homebrew_cask_module.html

There is a sudo_password that can be passed to the community.general.homebrew_cask module. This fixes the issue with Tenable. It will be available in /Library/NessusAgent/run/sbin/nessuscli

allebone commented 3 weeks ago

Thank You! I'll check it out, appreciate it!

BTW new Nessus Scanner is Apple Silicon optimized now WHEW its fast.