main.ymlΒΆ

---
- name: 🎬 Initialize dotlinker mapping list
  ansible.builtin.set_fact:
    nextcloud_dotlinker_mappings: []

- name: πŸ”¨ Build dotlinker mappings for Nextcloud folders
  ansible.builtin.set_fact:
    nextcloud_dotlinker_mappings: >-
      {{
        nextcloud_dotlinker_mappings + [
          {
            'name': 'nextcloud-' ~ (item | lower),
            'backend': 'cloud',
            'src': nextcloud_user_home_directory ~ item,
            'dest': nextcloud_cloud_directory ~ item
          }
        ]
      }}
  loop: "{{ nextcloud_dotlinker_folders }}"

- name: βž• Add dump mapping (Dump -> InstantUpload)
  ansible.builtin.set_fact:
    nextcloud_dotlinker_mappings: >-
      {{
        nextcloud_dotlinker_mappings + [
          {
            'name': 'nextcloud-dump',
            'backend': 'cloud',
            'src': nextcloud_user_home_directory ~ 'Dump',
            'dest': nextcloud_cloud_directory ~ 'InstantUpload'
          }
        ]
      }}

- name: πŸ“Œ Apply Nextcloud folder mappings via dotlinker
  ansible.builtin.include_role:
    name: dsk-dotlinker
  vars:
    dotlinker_user: "{{ lookup('users', WORKSTATION_USER).username }}"
    dotlinker_config_path: "{{ nextcloud_user_home_directory }}.config/dotlinker/config.yaml"
    dotlinker_replace: true
    dotlinker_apply: true
    dotlinker_mappings: "{{ nextcloud_dotlinker_mappings }}"