diff --git a/roles/sys-ctl-hlth-docker-volumes/tasks/01_core.yml b/roles/sys-ctl-hlth-docker-volumes/tasks/01_core.yml index f794a159..23d3a9ab 100644 --- a/roles/sys-ctl-hlth-docker-volumes/tasks/01_core.yml +++ b/roles/sys-ctl-hlth-docker-volumes/tasks/01_core.yml @@ -6,6 +6,7 @@ - include_role: name: sys-service vars: - system_service_on_calendar: "{{SYS_SCHEDULE_HEALTH_DOCKER_VOLUMES}}" - system_service_timer_enabled: true - system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}" + system_service_on_calendar: "{{ SYS_SCHEDULE_HEALTH_DOCKER_VOLUMES }}" + system_service_timer_enabled: true + system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }} {{ SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES }}" + system_service_tpl_exec_start: '{{ system_service_script_exec }} "{{ DOCKER_WHITELISTET_ANON_VOLUMES | join(" ") }}"' diff --git a/roles/sys-ctl-hlth-docker-volumes/templates/systemctl.service.j2 b/roles/sys-ctl-hlth-docker-volumes/templates/systemctl.service.j2 deleted file mode 100644 index 0ae234a6..00000000 --- a/roles/sys-ctl-hlth-docker-volumes/templates/systemctl.service.j2 +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Checking docker health -OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }} - -[Service] -Type=oneshot -ExecStart={{ system_service_script_exec }} "{{ DOCKER_WHITELISTET_ANON_VOLUMES | join(' ') }}" diff --git a/roles/sys-ctl-rpr-docker-hard/tasks/01_core.yml b/roles/sys-ctl-rpr-docker-hard/tasks/01_core.yml index 41a2802d..da642c45 100644 --- a/roles/sys-ctl-rpr-docker-hard/tasks/01_core.yml +++ b/roles/sys-ctl-rpr-docker-hard/tasks/01_core.yml @@ -6,6 +6,10 @@ - include_role: name: sys-service vars: - system_service_on_calendar: "{{ SYS_SCHEDULE_REPAIR_DOCKER_HARD }}" - system_service_timer_enabled: true - system_service_tpl_on_failure: "{{ SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES }}" + system_service_on_calendar: "{{ SYS_SCHEDULE_REPAIR_DOCKER_HARD }}" + system_service_timer_enabled: true + system_service_tpl_exec_start_pre: '/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(" ") }} --ignore {{ SYS_SERVICE_REPAIR_DOCKER_HARD }} --timeout "{{ SYS_TIMEOUT_RESTART_DOCKER }}"' + system_service_tpl_exec_start: '{{ system_service_script_exec }} {{ PATH_DOCKER_COMPOSE_INSTANCES }}' + system_service_tpl_exec_start_post: "/usr/bin/systemctl start {{ SYS_SERVICE_ON_FAILURE_COMPOSE }}" + system_service_tpl_on_failure: "{{ SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES }}" + diff --git a/roles/sys-ctl-rpr-docker-hard/templates/systemctl.service.j2 b/roles/sys-ctl-rpr-docker-hard/templates/systemctl.service.j2 deleted file mode 100644 index 46cab7da..00000000 --- a/roles/sys-ctl-rpr-docker-hard/templates/systemctl.service.j2 +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Restart Docker Instances -OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }} - -[Service] -Type=oneshot -ExecStartPre=/usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore {{ SYS_SERVICE_REPAIR_DOCKER_HARD }} --timeout "{{ SYS_TIMEOUT_RESTART_DOCKER }}" -ExecStart={{ system_service_script_exec }} {{ PATH_DOCKER_COMPOSE_INSTANCES }} \ No newline at end of file diff --git a/roles/sys-service/templates/systemctl.service.j2 b/roles/sys-service/templates/systemctl.service.j2 index 0fd74958..7af0dd5d 100644 --- a/roles/sys-service/templates/systemctl.service.j2 +++ b/roles/sys-service/templates/systemctl.service.j2 @@ -11,7 +11,8 @@ Type={{ system_service_tpl_type }} ('TimeoutStartSec', system_service_tpl_timeout_start_sec), ('ExecStartPre', system_service_tpl_exec_start_pre), ('ExecStart', system_service_tpl_exec_start), - ('RuntimeMaxSec', system_service_tpl_runtime) + ('ExecStartPost', system_service_tpl_exec_start_post), + ('RuntimeMaxSec', system_service_tpl_runtime), ] %} {{ val | systemd_directive(key) }} {% endfor %} \ No newline at end of file diff --git a/roles/sys-service/vars/main.yml b/roles/sys-service/vars/main.yml index 578e2f4a..efbdea61 100644 --- a/roles/sys-service/vars/main.yml +++ b/roles/sys-service/vars/main.yml @@ -20,7 +20,8 @@ system_service_script_exec: "{{ system_service_script_inter }} {{ system_servi # Service template system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}" system_service_tpl_type: "oneshot" -system_service_tpl_exec_start: "{{ system_service_script_exec }}" system_service_tpl_runtime: "{{ '' if system_service_tpl_type == 'oneshot' else SYS_SERVICE_DEFAULT_RUNTIME }}" system_service_tpl_exec_start_pre: "" +system_service_tpl_exec_start: "{{ system_service_script_exec }}" +system_service_tpl_exec_start_post: "" system_service_tpl_timeout_start_sec: "60s" \ No newline at end of file