app_password_drop.ymlΒΆ

---
- name: "πŸ—‘οΈ Destroy the retired app passwords of the bots"
  include_tasks: "{{ role_path }}/tasks/jmap_call.yml"
  vars:
    stalwart_jmap_body: >-
      {%- set calls = [] -%}
      {%- for owner in stalwart_app_password_owners -%}
      {%-   set _ = calls.append(['x:AppPassword/set', {'accountId': owner.value.account, 'destroy': owner.value.ids}, owner.key]) -%}
      {%- endfor -%}
      {{ {'using': ['urn:ietf:params:jmap:core', 'urn:stalwart:jmap'], 'methodCalls': calls} | to_json }}
  loop: "{{ stalwart_app_password_stale | dict2items | batch(STALWART_JMAP_MAX_METHOD_CALLS) | list }}"
  loop_control:
    loop_var: stalwart_app_password_owners
    label: "{{ stalwart_app_password_owners | map(attribute='key') | join(', ') }}"

- name: "🧹 Clear the dropped app passwords"
  ansible.builtin.set_fact:
    stalwart_app_password_stale: {}