# UniFi mode replacement is the explicitly approved exception to separate cleanup. # Unknown files and the active UniFi check are never removed here. - name: Linux | Ensure local check directory ansible.builtin.file: path: '{{ checkmk_linux_local_dir }}' state: directory mode: '0755' - name: Linux | Ensure configuration directory ansible.builtin.file: path: '{{ checkmk_linux_config_dir }}' state: directory mode: '0755' - name: Linux | Write the single UniFi configuration ansible.builtin.template: src: unifi.cfg.j2 dest: '{{ checkmk_linux_config_dir }}/unifi.cfg' owner: root group: root mode: '0600' validate: /bin/sh -n %s when: _checkmk_unifi_effective in ['network','os'] no_log: true diff: false register: _aim_unifi_write - name: Linux | Deploy selected monitoring checks ansible.builtin.copy: src: '{{ item.source }}' dest: '{{ checkmk_linux_local_dir }}/{{ item.filename }}' mode: '0755' loop: '{{ _checkmk_selected_scripts }}' loop_control: label: '{{ item.filename }}' register: _aim_check_copies - name: Linux | Remove only the opposite UniFi local check ansible.builtin.file: path: "{{ checkmk_linux_local_dir }}/{{ 'check_unifi-controller.sh' if _checkmk_unifi_effective == 'os' else 'check_unifi-os.sh' }}" state: absent when: _checkmk_unifi_effective in ['network','os'] register: _aim_opposite_remove