
# Services

## Meta
SYS_SERVICE_SUFFIX:                   ".{{ SOFTWARE_NAME | lower }}.service"
SYS_SERVICE_ALL_ENABLED:              false # Flush all services
SYS_SERVICE_DEFAULT_STATE:            "{{ omit }}"

## Names
SYS_SERVICE_CLEANUP_BACKUPS_OLD:      "{{ 'sys-ctl-cln-backups'     | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_CLEANUP_BACKUPS_FAILED:   "{{ 'sys-ctl-cln-faild-bkps'  | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_OPTIMIZE_DRIVE:           "{{ 'svc-opt-ssd-hdd'         | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_BACKUP_RMT_2_LOC:         "{{ 'svc-bkp-rmt-2-loc'       | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_REPAIR_DOCKER_SOFT:       "{{ 'sys-ctl-rpr-docker-soft' | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_REPAIR_DOCKER_HARD:       "{{ 'sys-ctl-rpr-docker-hard' | get_service_name(SOFTWARE_NAME) }}"
SYS_SERVICE_UPDATE_DOCKER:            "{{ 'update-docker'           | get_service_name(SOFTWARE_NAME) }}"

## On Failure
SYS_SERVICE_ON_FAILURE_COMPOSE:       "{{ 'sys-ctl-alm-compose'   | get_service_name(SOFTWARE_NAME,'%i.service') }}"
SYS_SERVICE_ON_FAILURE_EMAIL:         "{{ 'sys-ctl-alm-email'     | get_service_name(SOFTWARE_NAME,'%i.service') }}"
SYS_SERVICE_ON_FAILURE_TELEGRAM:      "{{ 'sys-ctl-alm-telegram'  | get_service_name(SOFTWARE_NAME,'%i.service') }}"

## Groups
SYS_SERVICE_GROUP_BACKUPS: >
  {{ (('sys-ctl-bkp-' | get_category_entries) + ('svc-bkp-' | get_category_entries))
     | map('regex_replace', '$', SYS_SERVICE_SUFFIX) | list }}

SYS_SERVICE_GROUP_CLEANUP: >
  {{ ('sys-ctl-cln-' | get_category_entries)
     | map('regex_replace', '$', SYS_SERVICE_SUFFIX) | list }}

SYS_SERVICE_GROUP_REPAIR: >
  {{ ('sys-ctl-rpr-' | get_category_entries)
     | map('regex_replace', '$', SYS_SERVICE_SUFFIX) | list }}

SYS_SERVICE_GROUP_OPTIMIZATION: >
  {{ ('svc-opt-' | get_category_entries)
     | map('regex_replace', '$', SYS_SERVICE_SUFFIX) | list }}

SYS_SERVICE_GROUP_MAINTANANCE: >
  {{ ('svc-mtn-' | get_category_entries)
     | map('regex_replace', '$', SYS_SERVICE_SUFFIX) | list }}
 
## Collection of services to manipulate the system
SYS_SERVICE_GROUP_MANIPULATION: >
  {{ 
    SYS_SERVICE_GROUP_BACKUPS + 
    SYS_SERVICE_GROUP_CLEANUP + 
    SYS_SERVICE_GROUP_REPAIR + 
    SYS_SERVICE_GROUP_OPTIMIZATION + 
    SYS_SERVICE_GROUP_MAINTANANCE +
    [ SYS_SERVICE_UPDATE_DOCKER ]
  }}

