Add immich-sync ansible role for photo library sync #63

Merged
eblume merged 4 commits from feature/immich-sync into main 2026-01-26 12:38:39 -08:00
Owner

Summary

  • Add immich_sync role that syncs macOS Photos Library to Immich
  • Uses osxphotos to export photos with metadata to staging directory
  • Uses immich-cli (via Docker) to upload to Immich server
  • LaunchAgent schedules hourly syncs following mcquack pattern
  • API key fetched from 1Password in playbook pre_tasks

Architecture

Photos Library → osxphotos export → ~/Pictures/immich-export/ → immich-cli upload → Immich

Prerequisites (manual)

  • Install osxphotos on indri: Add "pipx:osxphotos" = "latest" to ~/.config/mise/config.toml, run mise install
  • Docker is already installed on indri

Deployment and Testing

  • Dry run: mise run provision-indri -- --tags immich_sync --check --diff
  • Deploy: mise run provision-indri -- --tags immich_sync
  • Verify LaunchAgent: ssh indri 'launchctl list | grep immich'
  • Test manual sync: ssh indri '~/bin/immich-sync.sh'
  • Check logs: ssh indri 'tail -50 ~/Library/Logs/mcquack.immich-sync.out.log'
  • Verify photos in Immich at https://photos.ops.eblu.me

🤖 Generated with Claude Code

## Summary - Add `immich_sync` role that syncs macOS Photos Library to Immich - Uses osxphotos to export photos with metadata to staging directory - Uses immich-cli (via Docker) to upload to Immich server - LaunchAgent schedules hourly syncs following mcquack pattern - API key fetched from 1Password in playbook pre_tasks ## Architecture ``` Photos Library → osxphotos export → ~/Pictures/immich-export/ → immich-cli upload → Immich ``` ## Prerequisites (manual) - Install osxphotos on indri: Add `"pipx:osxphotos" = "latest"` to `~/.config/mise/config.toml`, run `mise install` - Docker is already installed on indri ## Deployment and Testing - [ ] Dry run: `mise run provision-indri -- --tags immich_sync --check --diff` - [ ] Deploy: `mise run provision-indri -- --tags immich_sync` - [ ] Verify LaunchAgent: `ssh indri 'launchctl list | grep immich'` - [ ] Test manual sync: `ssh indri '~/bin/immich-sync.sh'` - [ ] Check logs: `ssh indri 'tail -50 ~/Library/Logs/mcquack.immich-sync.out.log'` - [ ] Verify photos in Immich at https://photos.ops.eblu.me 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Implements hourly sync from macOS Photos Library to Immich:
- osxphotos exports photos with metadata to staging directory
- immich-cli uploads to Immich via Docker
- LaunchAgent schedules hourly syncs (mcquack pattern)
- API key stored securely from 1Password

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
LaunchAgents don't inherit PATH, so use explicit paths:
- /opt/homebrew/opt/mise/bin/mise x -- osxphotos (like borgmatic)
- /usr/local/bin/docker for Docker commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
osxphotos exports both original and edited versions by default.
Use --skip-edited and --skip-original-if-edited to control behavior
instead of non-existent --export-edited and --export-originals flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Creates ~/.immich-sync.lock with PID on start
- Checks if existing lock's process is still running (stale lock detection)
- Logs clear message when skipping due to active lock
- Releases lock on exit via trap (handles success and failure)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eblume merged commit 54945be0e3 into main 2026-01-26 12:38:39 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eblume/blumeops!63
No description provided.