diff --git a/tasks/main.yml b/tasks/main.yml index 0b46b4060497ef1afbfc3482fbc9a332d695a9f6..7afeceb1a5b4f5588928d68e330bf3d2fc50c247 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -52,8 +52,25 @@ ansible.builtin.import_tasks: "install_rkhunter.yml" tags: [rkhunter] +- name: > + Check if Archivematica is installed. We can only uninstall ClamAV if we're + not on an Archivematica system, because as of AM 1.15, `clamav` is a + dependency of `archivematica-mcp-client`. If we still uninstall `clamav`, + we WILL break the system. + If Archivematica is installed, then `grep` will return a "0" exit code, + otherwise it will return "1", which is also OK for us. + ansible.builtin.shell: # noqa command-instead-of-module + cmd: | + set -o pipefail # <-- adding this will prevent surprises + systemctl list-units | grep 'archivematica-' + executable: /bin/bash + register: archivematica_installed + changed_when: false + failed_when: archivematica_installed.rc > 1 + tags: [clamav] - name: include ClamAV uninstall task ansible.builtin.import_tasks: "uninstall_clamav.yml" + when: 'archivematica_installed.rc != 0' tags: [clamav] - name: include auditd install task