mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-26 21:45:20 +02:00
Implemented sys-svc-cln-anon-volumes as service so that it can be triggert after sys-ctl-rpr-docker-hard
This commit is contained in:
parent
95a2172fff
commit
f1a2967a37
@ -6,6 +6,7 @@ SYS_SERVICE_SUFFIX: ".{{ SOFTWARE_NAME | lower }}.service"
|
||||
|
||||
## Names
|
||||
SYS_SERVICE_CLEANUP_BACKUPS_FAILED: "{{ 'sys-ctl-cln-faild-bkps' | get_service_name(SOFTWARE_NAME) }}"
|
||||
SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES: "{{ 'sys-ctl-cln-anon-volumes' | 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_BACKUP_DOCKER_2_LOC: "{{ 'sys-ctl-bkp-docker-2-loc' | get_service_name(SOFTWARE_NAME) }}"
|
||||
|
18
roles/sys-ctl-cln-anon-volumes/tasks/main.yml
Normal file
18
roles/sys-ctl-cln-anon-volumes/tasks/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
- block:
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: dockreap
|
||||
|
||||
- include_role:
|
||||
name: sys-service
|
||||
vars:
|
||||
system_service_tpl_on_failure: "{{ SYS_SERVICE_ON_FAILURE_COMPOSE }}"
|
||||
system_service_tpl_exec_start: dockreap --no-confirmation
|
||||
system_service_tpl_exec_start_pre: /usr/bin/python {{ PATH_SYSTEM_LOCK_SCRIPT }} {{ SYS_SERVICE_GROUP_MANIPULATION | join(' ') }} --ignore {{ SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES }} --timeout "{{ SYS_TIMEOUT_CLEANUP_SERVICES }}"
|
||||
system_service_copy_files: false
|
||||
|
||||
- include_tasks: utils/run_once.yml
|
||||
when:
|
||||
- run_once_sys_ctl_cln_anon_volumes is not defined
|
1
roles/sys-ctl-cln-anon-volumes/vars/main.yml
Normal file
1
roles/sys-ctl-cln-anon-volumes/vars/main.yml
Normal file
@ -0,0 +1 @@
|
||||
system_service_id: sys-ctl-cln-anon-volumes
|
@ -6,5 +6,6 @@
|
||||
- include_role:
|
||||
name: sys-service
|
||||
vars:
|
||||
system_service_on_calendar: "{{SYS_SCHEDULE_REPAIR_DOCKER_HARD}}"
|
||||
system_service_on_calendar: "{{ SYS_SCHEDULE_REPAIR_DOCKER_HARD }}"
|
||||
system_service_timer_enabled: true
|
||||
system_service_tpl_on_failure: "{{ SYS_SERVICE_CLEANUP_ANONYMOUS_VOLUMES }}"
|
||||
|
@ -39,10 +39,12 @@
|
||||
|
||||
- name: refresh systemctl service when SYS_SERVICE_ALL_ENABLE
|
||||
block:
|
||||
- command: /bin/true
|
||||
- name: reload system daemon
|
||||
command: /bin/true
|
||||
notify: reload system daemon
|
||||
- command: /bin/true
|
||||
- name: refresh systemctl service
|
||||
command: /bin/true
|
||||
notify: refresh systemctl service
|
||||
when: not system_service_uses_at
|
||||
when: SYS_SERVICE_ALL_ENABLED | bool
|
||||
when: SYS_SERVICE_ALL_ENABLED | bool or system_force_flush | bool
|
||||
|
||||
|
@ -6,6 +6,7 @@ system_service_role_dir: "{{ [ playbook_dir, 'roles', system_service_role_
|
||||
system_service_script_dir: "{{ [ PATH_SYSTEMCTL_SCRIPTS, system_service_id ] | path_join }}"
|
||||
|
||||
## Settings
|
||||
system_force_flush: false # When set to true it activates the flushing of services :)
|
||||
system_service_copy_files: true # When set to false file copying will be skipped
|
||||
system_service_timer_enabled: false # When set to true timer will be loaded
|
||||
system_service_state: "{{ SYS_SERVICE_DEFAULT_STATE }}"
|
||||
|
@ -1,24 +0,0 @@
|
||||
- name: Check if docker is installed
|
||||
ansible.builtin.stat:
|
||||
path: /usr/bin/docker
|
||||
register: docker_bin
|
||||
|
||||
- block:
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: dockreap
|
||||
|
||||
- name: run dockreap with --no-confirmation
|
||||
command:
|
||||
cmd: "dockreap --no-confirmation"
|
||||
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
||||
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
||||
|
||||
- name: mark dockreap as run
|
||||
set_fact:
|
||||
run_once_sys_svc_cln_anon_volumes: true
|
||||
when:
|
||||
- run_once_sys_svc_cln_anon_volumes is not defined
|
||||
- docker_bin.stat.exists
|
@ -1,6 +1,11 @@
|
||||
- name: Load role to delete anonymous volumes
|
||||
- block:
|
||||
- name: Load role to delete anonymous volumes
|
||||
include_role:
|
||||
name: sys-svc-cln-anon-volumes
|
||||
name: sys-ctl-cln-anon-volumes
|
||||
vars:
|
||||
system_force_flush: true
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_sys_ctl_cln_anon_volumes is not defined
|
||||
|
||||
- name: Prune Docker resources
|
||||
become: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user