Skip to content

Ansible fails installing Google Chrome when it's already installed manually #268

@francescoben

Description

@francescoben

During the provisioning process, the Install cask packages task fails on the google-chrome cask if Chrome was previously installed manually (not via Homebrew).

It seems that the initial task Check if Google Chrome is already installed only checks for Homebrew installations (brew list --cask google-chrome) and does not detect manual installations in /Applications.
As a result, the playbook attempts to reinstall Chrome and fails due to permission errors.

Error output (excerpt):

TASK [Check if Google Chrome is already installed] **************************************************************************************************************
ok: [localhost] => {"changed": false, "cmd": "brew list --cask google-chrome >/dev/null 2>&1 && echo yes || echo no", "delta": "0:00:00.544475", "end": "2025-10-24 12:11:50.902784", "msg": "", "rc": 0, "start": "2025-10-24 12:11:50.358309", "stderr": "", "stderr_lines": [], "stdout": "no", "stdout_lines": ["no"]}

TASK [Remove Google Chrome from install list if already installed] **********************************************************************************************
skipping: [localhost] => {"changed": false, "false_condition": "'google-chrome' in all_cask_packages and google_chrome_installed.stdout == 'yes'", "skip_reason": "Conditional result was False"}

......

TASK [Install cask packages] ************************************************************************************************************************************
changed: [localhost] => (item=font-jetbrains-mono-nerd-font) => {"ansible_loop_var": "item", "changed": true, "item": "font-jetbrains-mono-nerd-font", "msg": "Cask installed: font-jetbrains-mono-nerd-font"}
changed: [localhost] => (item=font-caskaydia-mono-nerd-font) => {"ansible_loop_var": "item", "changed": true, "item": "font-caskaydia-mono-nerd-font", "msg": "Cask installed: font-caskaydia-mono-nerd-font"}
changed: [localhost] => (item=zoom) => {"ansible_loop_var": "item", "changed": true, "item": "zoom", "msg": "Cask installed: zoom"}
[ERROR]: Task failed: Module failed: Warning: It seems there is already an App at '/Applications/Google Chrome.app'; overwriting.
chown: /Applications/Google Chrome.app/Contents/CodeResources: Operation not permitted

.....

PLAY RECAP ******************************************************************************************************************************************************
localhost                  : ok=14   changed=0    unreachable=0    failed=1    skipped=2    rescued=0    ignored=0

error: Recipe `run-ansible-playbook` failed with exit code 2

Steps to reproduce

  • install Google Chrome manually (e.g., from the official website)
  • run sparkdock
  • the playbook fails during the Install cask packages step

Possible fix

Update the Check if Google Chrome is already installed task to also detect Chrome installations outside of Homebrew (e.g., check if /Applications/Google Chrome.app exists).

Environment

  • macOS version: 15.7
  • sparkdock version: bbddd5e (master)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions