---
- name: (Deprecation) Catch and report renamed matrix-synapse-auto-compressor settings
  ansible.builtin.fail:
    msg: >-
      Your configuration contains a variable, which now has a different name.
      Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  when: "item.old in vars"
  with_items:
    - "old": "matrix_synapse_auto_compressor_calendar"
      "new": "matrix_synapse_auto_compressor_schedule"
    - "old": "matrix_synapse_auto_compressor_container_image_name_prefix"
      "new": "matrix_synapse_auto_compressor_container_image_registry_prefix"

- name: Fail if required matrix-synapse-auto-compressor settings not defined
  ansible.builtin.fail:
    msg: >
      You need to define a required configuration setting (`{{ item }}`).
  when: "vars[item] == ''"
  with_items:
    - matrix_synapse_auto_compressor_database_hostname
    - matrix_synapse_auto_compressor_database_password
