- name: Include dependencies
  include_role:
    name: '{{ item }}'
  loop:
  - sys-ctl-alm-compose
  - sys-lock
  - sys-svc-directory-validator
  - sys-daemon

- name: "pkgmgr install"
  include_role:
    name: pkgmgr-install
  vars:
    package_name: "{{ CLN_FAILED_DOCKER_BACKUPS_PKG }}"

- name: "Retrieve {{ CLN_FAILED_DOCKER_BACKUPS_PKG }} path from pkgmgr"
  command: "pkgmgr path {{ CLN_FAILED_DOCKER_BACKUPS_PKG }}"
  register: pkgmgr_output
  changed_when: false

- name: Set fact for BACKUP_CLEANUP_SCRIPT
  set_fact:
    BACKUP_CLEANUP_SCRIPT: "{{ pkgmgr_output.stdout.rstrip('/') ~ '/cleanup-all.sh' }}"
  changed_when: false

- include_role:
    name: sys-systemctl
  vars:
    systemctl_timer_enabled:  true
    systemctl_on_calendar: "{{SYS_SCHEDULE_CLEANUP_FAILED_BACKUPS}}"
    systemctl_copy_files: false
