Optimized performance by moving multiple similar when includes to own tasks file

This commit is contained in:
2025-08-11 13:15:31 +02:00
parent 6318611931
commit 1ba50397db
41 changed files with 616 additions and 733 deletions

View File

@@ -0,0 +1,37 @@
- name: "pkgmgr install"
include_role:
name: pkgmgr-install
vars:
package_name: checkcsp
- name: rebuild checkcsp docker image
shell: checkcsp build
# Todo this could be optimized in the future
- name: "create {{ health_csp_crawler_folder }}"
file:
path: "{{ health_csp_crawler_folder }}"
state: directory
mode: 0755
- name: copy sys-hlth-csp.py
copy:
src: sys-hlth-csp.py
dest: "{{ health_csp_crawler_script }}"
mode: 0755
- name: create sys-hlth-csp.infinito.service
template:
src: sys-hlth-csp.service.j2
dest: /etc/systemd/system/sys-hlth-csp.infinito.service
notify: reload sys-hlth-csp.infinito.service
- name: set service_name to role_name
set_fact:
service_name: "{{ role_name }}"
- name: include systemd timer role
include_role:
name: sys-timer
vars:
on_calendar: "{{ on_calendar_health_csp_crawler }}"

View File

@@ -1,48 +1,4 @@
- name: "pkgmgr install"
include_role:
name: pkgmgr-install
vars:
package_name: checkcsp
when: run_once_sys_hlth_csp is not defined
- name: rebuild checkcsp docker image
shell: checkcsp build
# Todo this could be optimized in the future
- name: "create {{ health_csp_crawler_folder }}"
file:
path: "{{ health_csp_crawler_folder }}"
state: directory
mode: 0755
when: run_once_sys_hlth_csp is not defined
- name: copy sys-hlth-csp.py
copy:
src: sys-hlth-csp.py
dest: "{{ health_csp_crawler_script }}"
mode: 0755
when: run_once_sys_hlth_csp is not defined
- name: create sys-hlth-csp.infinito.service
template:
src: sys-hlth-csp.service.j2
dest: /etc/systemd/system/sys-hlth-csp.infinito.service
notify: reload sys-hlth-csp.infinito.service
when: run_once_sys_hlth_csp is not defined
- name: set service_name to role_name
set_fact:
service_name: "{{ role_name }}"
when: run_once_sys_hlth_csp is not defined
- name: include systemd timer role
include_role:
name: sys-timer
vars:
on_calendar: "{{ on_calendar_health_csp_crawler }}"
when: run_once_sys_hlth_csp is not defined
- name: run the health_csp tasks once
set_fact:
run_once_sys_hlth_csp: true
when: run_once_sys_hlth_csp is not defined
- block:
- include_tasks: 01_core.yml
- include_tasks: utils/run_once.yml
when: run_once_sys_hlth_csp is not defined