From bad242689627fc062853fb074faf1a83d0de2755 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 11 Nov 2026 07:34:26 -0700 Subject: [PATCH] Mac: automatic login for phil The Mac powers back on after a power cut but stopped at the login window, so nothing that needs a login session (dashboard, Podman VM for Hermes's sandbox, BlueBubbles, Beeper) came back. Turn on automatic login with sysadminctl, using phil's password from the vault. FileVault is off, so it works unattended. User accepted the physical-access trade-off. Co-Authored-By: Claude Opus 5.5 --- roles/mac/README.md | 4 ++++ roles/mac/tasks/autologin.yml | 21 +++++++++++++++++++++ roles/mac/tasks/main.yml | 4 ++++ 3 files changed, 29 insertions(+) create mode 100644 roles/mac/tasks/autologin.yml diff --git a/roles/mac/README.md b/roles/mac/README.md index 8eec0d5..f8e1d37 100644 --- a/roles/mac/README.md +++ b/roles/mac/README.md @@ -40,6 +40,10 @@ Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`, copied to `~/.hermes/scripts/`. Missing jobs are created; existing ones are left as they are. Today: `hermes-update-notice`, which messages you on Telegram on Mondays only when a new stable Hermes release is out. +- **Automatic login** (tag `autologin`): phil is logged in automatically after + a reboot, so everything that needs a login session (dashboard, Podman VM, + BlueBubbles, Beeper) comes back after a power cut. Uses phil's password from + the vault; redeploy after changing it. 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. diff --git a/roles/mac/tasks/autologin.yml b/roles/mac/tasks/autologin.yml new file mode 100644 index 0000000..7929685 --- /dev/null +++ b/roles/mac/tasks/autologin.yml @@ -0,0 +1,21 @@ +# Log phil in automatically after a reboot (the Mac powers itself back on +# after a power cut): the dashboard, the Podman VM, BlueBubbles and Beeper +# all need a login session. FileVault is off, so this works unattended. +# It uses phil's login password from the vault; if that password changes, +# update vault_cogitator02.become_password and redeploy. +- name: Read automatic login + ansible.builtin.command: + argv: [sysadminctl, -autologin, status] + register: autologin_status + changed_when: false + check_mode: false + +- name: Turn on automatic login for {{ ansible_user }} + ansible.builtin.command: + argv: [sysadminctl, -autologin, set, -userName, "{{ ansible_user }}", + -password, "{{ vault_cogitator02.become_password }}"] + become: true + no_log: true + when: >- + (autologin_status.stdout ~ autologin_status.stderr) + is not search('Automatic login is ON.*' ~ ansible_user, ignorecase=true) diff --git a/roles/mac/tasks/main.yml b/roles/mac/tasks/main.yml index ba14aad..80ce799 100644 --- a/roles/mac/tasks/main.yml +++ b/roles/mac/tasks/main.yml @@ -45,3 +45,7 @@ - name: Podman VM ansible.builtin.import_tasks: podman.yml tags: podman + +- name: Automatic login + ansible.builtin.import_tasks: autologin.yml + tags: autologin