inframatic¶
inframatic sets up macOS machines and accounts, then checks them for drift. One controller applies the settings to each machine over SSH, or to itself. Settings are records: the CLI writes each one, then reads it back.
Commands¶
Command |
What it does |
|---|---|
|
Applies the roles of each machine and of its accounts, then reads each change back. |
|
Compares each machine with its records and changes nothing. Exits with |
|
Prints the facts that the records test: macOS version, FileVault, SIP, full disk access, Command Line Tools, Homebrew and mpm. |
|
Restarts a machine, unlocks FileVault over SSH, then waits for macOS to run. |
|
Unlocks FileVault over SSH on a machine that started by itself, like after a power cut. |
check never writes, so a scheduled drift run cannot change a machine, even with a wrong flag. apply and check take --only PATTERN, a glob on the record IDs, and --role ROLE to run part of the records.
Each run of apply and check writes its full log to ~/Library/Logs/inframatic/.
Inventory¶
The inventory is a folder of TOML files, one per machine, kept outside any public repository. Pass it with --inventory, the INFRAMATIC_INVENTORY variable, or the inventory key of the configuration file.
roles = ["server"]
transport = "ssh"
host = "orchard-mac"
[[accounts]]
name = "alice"
roles = ["admin"]
[unlock]
host = "orchard-mac-unlock"
password = "keychain:orchard-mac-alice"
host is a Host alias of the controller’s SSH configuration: the transport runs /usr/bin/ssh, which applies that configuration as written. transport = "local" marks the controller itself.
The unlock table serves reboot and unlock. macOS 26 and later run an sshd before FileVault unlocks the volume, and a password login there unlocks it (man apple_ssh_and_filevault). host is the SSH alias of that sshd, which takes passwords only. password names the password of its account in the controller’s login keychain, as keychain:SERVICE or keychain:SERVICE/ACCOUNT: ssh reads it through SSH_ASKPASS, so the password never enters a command line or a log.
Roles¶
Machine roles apply once per machine: base, desktop and server, which include base, and ci, which includes server. Account roles apply once per account: owner, admin and guest.
Records¶
A record holds one piece of desired state. The records ship with the package, in inframatic/data/records/:
[[defaults]]
domain = "org.example.weather"
key = "Unit"
value = "celsius"
roles = ["owner"]
Kind |
What it sets |
|---|---|
|
The newest Command Line Tools that |
|
Homebrew, from the installer package of a pinned release, checked against its SHA-256. |
|
One Homebrew formula, like mpm. |
|
The packages of an mpm file, installed with a cooldown on their release age. |
|
The content, mode and owner of a file, written through a checked temporary file. |
|
Remote Login or Screen Sharing, on or off. |
|
One |
|
The container of a sandboxed app: the app opens once in the background, then quits. |
|
One key of a preferences domain, or of a domain inside an app container. |
The kinds run in that order: the Command Line Tools, Homebrew and mpm come before the packages they install, the files of the system go in before the services that read them, the first launch of an app creates its container, then the settings go in. Every record takes these keys:
Key |
Meaning |
|---|---|
|
The roles that apply the record. |
|
Facts that must hold, or the record is skipped. |
|
Facts that must hold, or the record is blocked and the report names the step to do by hand. |
|
The macOS versions the record applies to, like |
|
The mSCP rule the record implements, like |
|
Write as root, like a key of |
Two records that set the same key on the same account are an error.