Ich versuche, Homebrew über mein Playbook auf einem Linux-Ubuntu-Hostknoten zu installieren, komme aber nicht damit klar. Ich habe ein paar Variationen ausprobiert und jede scheitert.
Versuche
Versuch Eins
Der Vollständigkeit halber Hier ist der Testpfad.
Code: Select all
- name: "foo brew"
hosts: "machines"
become: true
become_method: sudo
become_user: foo
tasks:
- name: "install HomeBrew"
expect:
command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
responses:
"Press RETURN/ENTER to continue or any other key to abort:": ''
register: hombrew
- debug:
var: homebrew.stdout_lines
Ergebnisse
Code: Select all
fatal: [192.168.1.000]: FAILED! => {"changed": true, "cmd": "/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"", "delta": "0:00:00.173932", "end": "2025-01-04 09:53:21.517005", "msg": "non-zero return code", "rc": 127, "start": "2025-01-04 09:53:21.343073", "stdout": "/bin/bash: line 1: #!/bin/bash: No such file or directory", "stdout_lines": ["/bin/bash: line 1: #!/bin/bash: No such file or directory"]}
Versuch zwei
Dieses Muster schien das vielversprechendste zu sein. Führen Sie die Brew-Installation mit dem Shell-Modul aus und umgehen Sie die Eingabeaufforderungen. Seltsam ist auch, dass der Fehler vom Befehl nicht weiterhin besteht.
Code: Select all
- name: "foo brew"
hosts: "machines"
become: true
become_method: sudo
become_user: foo
tasks:
- name: "install HomeBrew"
become: true
become_method: sudo
become_user: foo
shell: echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
register: brew
- debug:
var: brew.stdout_lines
Ergebnisse
Code: Select all
fatal: [192.168.1.000]: FAILED! => {"changed": true, "cmd": "echo | /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"", "delta": "0:00:00.211944", "end": "2025-01-04 09:56:57.957293", "msg": "non-zero return code", "rc": 1, "start": "2025-01-04 09:56:57.745349", "stderr": "Warning: Running in non-interactive mode because `stdin` is not a TTY.\nInsufficient permissions to install Homebrew to \"/home/linuxbrew/.linuxbrew\" (the default prefix).\n\nAlternative (unsupported) installation methods are available at:\nhttps://docs.brew.sh/Installation#alternative-installs\n\nPlease note this will require most formula to build from source, a buggy, slow and energy-inefficient experience.\nWe will close any issues without response for these unsupported configurations.", "stderr_lines": ["Warning: Running in non-interactive mode because `stdin` is not a TTY.", "Insufficient permissions to install Homebrew to \"/home/linuxbrew/.linuxbrew\" (the default prefix).", "", "Alternative (unsupported) installation methods are available at:", "https://docs.brew.sh/Installation#alternative-installs", "", "Please note this will require most formula to build from source, a buggy, slow and energy-inefficient experience.", "We will close any issues without response for these unsupported configurations."], "stdout": "==> Checking for `sudo` access (which may request your password)...", "stdout_lines": ["==> Checking for `sudo` access (which may request your password)..."]}
Ich bin ratlos und frustriert, da dies ein sehr glücklicher Anwendungsfall für Maschinen zu sein scheint Einrichtung und Bereitstellung. Ich bin mir sicher, dass mir etwas Einfaches fehlt. Vielen Dank im Voraus.