Add Homebrew installation and packages to customize playbook

Installs Homebrew as the openclaw user (idempotent via creates guard),
adds it to PATH in .bashrc, then installs the four leaf packages present
on zap: gogcli, himalaya, kubernetes-cli, opencode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
William Valentin
2026-03-12 13:50:48 -07:00
parent ebce788702
commit c8aaa40cd8

View File

@@ -46,6 +46,50 @@
cmd: loginctl enable-linger openclaw
changed_when: false
# ── Homebrew ───────────────────────────────────────────────────────────────
- name: Install Homebrew dependencies
ansible.builtin.apt:
name:
- build-essential
- procps
- curl
- file
- git
state: present
- name: Install Homebrew (as openclaw user)
ansible.builtin.shell: |
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
become_user: openclaw
args:
creates: /home/linuxbrew/.linuxbrew/bin/brew
- name: Add Homebrew to openclaw user PATH
ansible.builtin.blockinfile:
path: /home/openclaw/.bashrc
marker: "# {mark} HOMEBREW"
block: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
owner: openclaw
group: openclaw
create: true
- name: Install Homebrew packages
ansible.builtin.shell: |
brew list {{ item }} 2>/dev/null || brew install {{ item }}
become_user: openclaw
environment:
HOME: /home/openclaw
PATH: /home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
loop:
- gogcli
- himalaya
- kubernetes-cli
- opencode
register: brew_install
changed_when: "'Installing' in brew_install.stdout"
# ── Automatic security updates ─────────────────────────────────────────
# The upstream role installs unattended-upgrades with security-only updates.
# We extend it here to enable automatic reboots for kernel/libc updates,