aim-web2.1.0rc9
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
|
||||
- name: Cleanup | Remove obsolete managed local check
|
||||
ansible.builtin.file:
|
||||
path: '{{ checkmk_linux_local_dir }}/{{ item }}'
|
||||
state: absent
|
||||
loop: '{{ _checkmk_remove_paths }}'
|
||||
register: _aim_cleanup_files
|
||||
- name: Cleanup | Remove UniFi configuration only when UniFi is disabled
|
||||
ansible.builtin.file:
|
||||
path: '{{ checkmk_linux_config_dir }}/unifi.cfg'
|
||||
state: absent
|
||||
when: _checkmk_unifi_effective == 'disabled'
|
||||
diff: false
|
||||
no_log: true
|
||||
register: _aim_cleanup_unifi
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
- name: Cleanup | Validate opt-in
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- (checkmk_cleanup_enabled) is boolean or (checkmk_cleanup_enabled | string | lower) in ['true',
|
||||
'false']
|
||||
fail_msg: checkmk_cleanup_enabled must be boolean.
|
||||
quiet: true
|
||||
- name: Cleanup | Build obsolete paths
|
||||
ansible.builtin.set_fact:
|
||||
_checkmk_remove_paths: "{{ _checkmk_obsolete_scripts | map(attribute='filename') | list }}"
|
||||
- name: Cleanup | Candidate files
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
directory: "{{ checkmk_windows_local_dir if ansible_facts.os_family == 'Windows' else checkmk_linux_local_dir
|
||||
}}"
|
||||
files: '{{ _checkmk_remove_paths }}'
|
||||
unifi_config: "{{ 'remove only when disabled' if ansible_facts.os_family != 'Windows' and _checkmk_unifi_effective
|
||||
== 'disabled' else 'retained' }}"
|
||||
mode: "{{ 'DELETE APPROVED' if checkmk_cleanup_enabled | bool else 'PREVIEW ONLY' }}"
|
||||
- name: Cleanup | linux
|
||||
ansible.builtin.include_tasks: linux.yml
|
||||
when:
|
||||
- checkmk_cleanup_enabled | bool
|
||||
- ansible_facts.os_family != 'Windows'
|
||||
- name: Cleanup | windows
|
||||
ansible.builtin.include_tasks: windows.yml
|
||||
when:
|
||||
- checkmk_cleanup_enabled | bool
|
||||
- ansible_facts.os_family == 'Windows'
|
||||
- name: AIM | Publish operation result
|
||||
ansible.builtin.set_stats:
|
||||
per_host: true
|
||||
aggregate: false
|
||||
data:
|
||||
aim_output:
|
||||
protocol: aim_output_v1
|
||||
schema: managed_cleanup_preview_v1
|
||||
data: "{{ _checkmk_remove_paths | aim_report_cleanup(checkmk_windows_local_dir if ansible_facts.os_family
|
||||
== 'Windows' else checkmk_linux_local_dir, _aim_cleanup_files | default({}), _checkmk_unifi_effective
|
||||
if ansible_facts.os_family != 'Windows' else 'not_applicable', _aim_cleanup_unifi | default({}), checkmk_cleanup_enabled
|
||||
| bool, ansible_check_mode) }}"
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
- name: Cleanup | Remove obsolete managed local check or legacy local plugin copy
|
||||
ansible.windows.win_file:
|
||||
path: '{{ checkmk_windows_local_dir }}\{{ item }}'
|
||||
state: absent
|
||||
loop: '{{ _checkmk_remove_paths }}'
|
||||
register: _aim_cleanup_local_files
|
||||
|
||||
- name: Cleanup | Remove obsolete managed custom plugin
|
||||
ansible.windows.win_file:
|
||||
path: '{{ checkmk_windows_plugin_dir }}\{{ item }}'
|
||||
state: absent
|
||||
loop: >-
|
||||
{{ _checkmk_obsolete_scripts
|
||||
| selectattr('destination', 'defined')
|
||||
| selectattr('destination', 'equalto', 'custom_plugin')
|
||||
| map(attribute='filename') | list }}
|
||||
register: _aim_cleanup_custom_plugin_files
|
||||
|
||||
- name: Cleanup | Remove obsolete known legacy built-in plugin copy
|
||||
ansible.windows.win_file:
|
||||
path: '{{ checkmk_windows_builtin_plugin_dir }}\{{ item }}'
|
||||
state: absent
|
||||
loop: >-
|
||||
{{ _checkmk_remove_paths
|
||||
| select('in', ['veeam_o365_status.ps1', 'veeam_backup_status.ps1'])
|
||||
| list }}
|
||||
register: _aim_cleanup_builtin_files
|
||||
|
||||
- name: Cleanup | Combine Windows cleanup results
|
||||
ansible.builtin.set_fact:
|
||||
_aim_cleanup_files:
|
||||
results: >-
|
||||
{{ (_aim_cleanup_local_files.results | default([]))
|
||||
+ (_aim_cleanup_custom_plugin_files.results | default([]))
|
||||
+ (_aim_cleanup_builtin_files.results | default([])) }}
|
||||
Reference in New Issue
Block a user