Я пытаюсь установить homebrew через свою книгу игр на узел хостов Linux Ubuntu, но не могу в этом разобраться. Я попробовал несколько вариантов, и каждый провалился.
Попытки
Попытка первая
Для полноты картины вот пробный путь.
Код: Выделить всё
- 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
Результаты
Код: Выделить всё
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"]}
Попытка вторая
Этот паттерн показался наиболее многообещающим. Запустите установку Brew с модулем оболочки и пропустите подсказки. Также странно, что ошибка команды не сохраняется.
Код: Выделить всё
- 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
Результаты
Код: Выделить всё
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)..."]}
Я озадачен и расстроен, поскольку это кажется очень удачным вариантом использования для машины. настройка и обеспечение. Я уверен, что мне не хватает чего-то простого. Заранее спасибо.
Подробнее здесь: https://stackoverflow.com/questions/793 ... host-nodes