--- - name: Windows | Ensure Checkmk local directory ansible.windows.win_file: path: '{{ checkmk_windows_local_dir }}' state: directory - name: Windows | Ensure Checkmk custom plugin directory ansible.windows.win_file: path: '{{ checkmk_windows_plugin_dir }}' state: directory when: >- {{ _checkmk_selected_scripts | selectattr('destination', 'defined') | selectattr('destination', 'equalto', 'custom_plugin') | list | length > 0 }} - name: Windows | Deploy selected monitoring checks ansible.windows.win_copy: src: '{{ item.source }}' dest: >- {{ (checkmk_windows_plugin_dir if item.destination | default('local') == 'custom_plugin' else checkmk_windows_local_dir) }}\{{ item.filename }} loop: '{{ _checkmk_selected_scripts }}' loop_control: label: '{{ item.filename }}' register: _aim_check_copies - name: Windows | Normalize ACL on AIM-managed monitoring checks ansible.builtin.include_role: name: checkmk_windows_acl vars: checkmk_windows_acl_paths: - >- {{ (checkmk_windows_plugin_dir if checkmk_acl_script.destination | default('local') == 'custom_plugin' else checkmk_windows_local_dir) }}\{{ checkmk_acl_script.filename }} loop: '{{ _checkmk_selected_scripts }}' loop_control: loop_var: checkmk_acl_script label: '{{ checkmk_acl_script.filename }}' - name: Windows | Remove legacy local copies after custom plugin relocation ansible.windows.win_file: path: '{{ checkmk_windows_local_dir }}\{{ item.filename }}' state: absent loop: >- {{ _checkmk_selected_scripts | selectattr('destination', 'defined') | selectattr('destination', 'equalto', 'custom_plugin') | list }} loop_control: label: '{{ item.filename }}' register: _aim_custom_plugin_legacy_local_remove - name: Windows | Remove known legacy built-in copies after custom plugin relocation ansible.windows.win_file: path: '{{ checkmk_windows_builtin_plugin_dir }}\{{ item.filename }}' state: absent loop: >- {{ _checkmk_selected_scripts | selectattr('destination', 'defined') | selectattr('destination', 'equalto', 'custom_plugin') | selectattr('filename', 'in', ['veeam_o365_status.ps1', 'veeam_backup_status.ps1']) | list }} loop_control: label: '{{ item.filename }}' register: _aim_custom_plugin_legacy_builtin_remove