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 <noreply@anthropic.com>
22 lines
919 B
YAML
22 lines
919 B
YAML
# 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)
|