diff --git a/CLAUDE.md b/CLAUDE.md index ffaa1f0..79b73f8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,7 @@ bin/deploy --tags services # every service, no system setup bin/deploy --tags common,cron # base setup and cron jobs only bin/deploy --check --diff --tags # dry run, allowed from any checkout PLAYBOOK=dns.yml bin/deploy # Route53 records +PLAYBOOK=mac.yml bin/deploy # the Mac (cogitator-02) bin/vault-run # edit secrets ($VAULT_PLAIN) # First-time setup of a new server (public IP, before Tailscale) @@ -72,6 +73,13 @@ One server, `cogitator-01` (netcup VPS), listed twice in `hosts.yml`: DNS A records point at the public IP; Caddy on the same machine routes by subdomain. +A second host, `cogitator-02` (group `mac`, reached at +`cogitator-02.porgy-porgy.ts.net` over Tailscale), is an Apple Silicon Mac +running Hermes Agent. `mac.yml` manages it with the `mac` role, logged in as +phil without passwordless sudo: tasks that need root set `become: true` and use +`vault_cogitator02.become_password`. Homebrew tasks must not use become. See +`roles/mac/README.md`. + ### Roles (`site.yml` runs common, docker, cron) - **bootstrap**: user, SSH key, passwordless sudo, UFW, then `artis3n.tailscale`. - **common**: `aptitude`, `jq`, daily unattended security updates, SSH keys only (no root login), UFW on with default deny. diff --git a/README.md b/README.md index e7d0682..668a208 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,13 @@ lists it twice, under two names: All public DNS records point at the public IP. Caddy on the same machine takes ports 80/443 and passes each subdomain to the right container. +### The Mac + +`cogitator-02` (group `mac`, reached at `cogitator-02.porgy-porgy.ts.net` over +Tailscale) is an Apple Silicon Mac that runs Hermes Agent. It has its own +playbook, `mac.yml`, so it never runs with the server's deploys. See +`roles/mac/README.md`. + ## Services | Category | Service | Address | Login | @@ -58,6 +65,7 @@ the Listmonk signup form. ``` ├── site.yml # Main playbook: common, docker and cron roles +├── mac.yml # The Mac (cogitator-02): mac role ├── bootstrap.yml # First-time server setup (user, SSH key, UFW, Tailscale) ├── dns.yml # Route53 A records (adds current ones, removes retired ones) ├── deploy-guard.yml # Stops real runs from anything but a clean origin/main @@ -122,6 +130,7 @@ bin/deploy --tags services # every service, no system setup bin/deploy # everything in site.yml bin/deploy --check --diff --tags caddy # dry run (allowed from any checkout) PLAYBOOK=dns.yml bin/deploy # DNS records +PLAYBOOK=mac.yml bin/deploy # the Mac (cogitator-02) ``` Category tags: `infrastructure`, `development`, `media`, `productivity`, diff --git a/group_vars/mac/main.yml b/group_vars/mac/main.yml new file mode 100644 index 0000000..2902faa --- /dev/null +++ b/group_vars/mac/main.yml @@ -0,0 +1,12 @@ +# cogitator-02: an Apple Silicon Mac on the tailnet. Ansible manages it as +# phil; only tasks that set `become: true` use sudo. +ansible_python_interpreter: /usr/bin/python3 +ansible_become_password: "{{ vault_cogitator02.become_password }}" + +homebrew_taps: + - beeper/tap +homebrew_formulae: + - beeper/tap/bbctl +homebrew_casks: + - beeper + - claude-code diff --git a/hosts.yml b/hosts.yml index 24c4006..0e280c5 100644 --- a/hosts.yml +++ b/hosts.yml @@ -7,4 +7,9 @@ docker: hosts: docker-01: ansible_host: 100.70.169.99 - ansible_user: phil \ No newline at end of file + ansible_user: phil +mac: + hosts: + cogitator-02: + ansible_host: cogitator-02.porgy-porgy.ts.net + ansible_user: phil diff --git a/mac.yml b/mac.yml new file mode 100644 index 0000000..6d4948b --- /dev/null +++ b/mac.yml @@ -0,0 +1,7 @@ +- import_playbook: deploy-guard.yml + +# The Mac (cogitator-02). Kept out of site.yml so it never runs with the +# server's deploys: PLAYBOOK=mac.yml bin/deploy +- hosts: mac + roles: + - { role: mac, tags: ["mac"] } diff --git a/roles/mac/README.md b/roles/mac/README.md new file mode 100644 index 0000000..4d8fa86 --- /dev/null +++ b/roles/mac/README.md @@ -0,0 +1,15 @@ +# mac + +Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`, +`PLAYBOOK=mac.yml bin/deploy`). + +- **Homebrew**: taps, formulae and casks listed in `group_vars/mac/main.yml`. + Installs what's missing; never upgrades or removes. + +Ansible logs in as `phil`. sudo needs phil's password, which is in the vault +as `vault_cogitator02.become_password`; only tasks with `become: true` use it. +phil deliberately doesn't get passwordless sudo, because Hermes Agent runs as +phil and takes commands over Telegram. + +Not managed here: Hermes Agent (`~/.hermes`, self-updating git install, +launchd agent `ai.hermes.gateway`) and Tailscale. diff --git a/roles/mac/tasks/main.yml b/roles/mac/tasks/main.yml new file mode 100644 index 0000000..718764d --- /dev/null +++ b/roles/mac/tasks/main.yml @@ -0,0 +1,17 @@ +# Homebrew refuses to run as root, so none of these use become. +- name: Homebrew taps + community.general.homebrew_tap: + name: "{{ homebrew_taps }}" + tags: homebrew + +- name: Homebrew formulae + community.general.homebrew: + name: "{{ homebrew_formulae }}" + state: present + tags: homebrew + +- name: Homebrew casks + community.general.homebrew_cask: + name: "{{ homebrew_casks }}" + state: present + tags: homebrew