Skip to content

Ansiblizing a recipe for Swarm

This section is under construction 🔨

This section is a serious work-in-progress, and reflects the current development on the sponsors' "premix" repository So... There may be errors and inaccuracies. Jump into Discord in the #premium-support channel if you're encountering issues 😁

Update deploy.yml

Edit ansible/deploy.yml, and find the swarm section, starting with:

### non-critical swarm recipes start here, alphabeticized

Add an import_role task like this (alphabeticized) at the bottom:

# Setup immich
- { import_role: { name: docker-stack }, vars: { recipe: immich }, tags: [ immich ], when: combined_config.immich.enabled | bool }

Update config

Edit ansible/group_vars/all/main.yml, and edit the recipe_default_config dictionary, adding the necessary values, like this:

immich:
  enabled: false 
  run_pre_deploy: | 
    mkdir -p /var/data/immich/database-dump
    mkdir -p /var/data/immich/upload
    mkdir -p /var/data/runtime/immich/database 
  run_post_deploy: | 
    echo "this is just an example to show that it's possible to run tasks post-deploy!"

Ensure the recipe files are valid

The playbook assumes that /<recipe-name>/<recipe-name>.yml and /<recipe-name>/<recipe-name>.env-sample exist. Without these (and any other supporting files, ending in -sample), unpleasant things will happen!