--- - name: Converge Unraid Docker Compose stacks hosts: unraid_servers gather_facts: true vars: repo_root: "{{ playbook_dir }}/../../../.." # Comma-separated stack names to restrict this run to, e.g. # `-e only_stacks=forgejo` or `-e only_stacks=forgejo,postgres`. # Empty (the default) converges every stack declared for the host. only_stacks: "" tasks: # "Converge", not "deploy": an entry carrying `state: absent` is torn down # rather than brought up. Removals have to stay in the list to be acted # on — see the header comment in roles/compose_stack/tasks/main.yml. - name: Converge each declared stack ansible.builtin.include_role: name: compose_stack loop: >- {{ stacks if only_stacks == '' else stacks | selectattr('name', 'in', only_stacks.split(',')) | list }} loop_control: loop_var: stack label: "{{ stack.name }}"