commited current state (new functions, may not work by now)

This commit is contained in:
Ansible Servercow
2025-10-08 09:32:02 +02:00
parent e5f83941b9
commit b21a80af07
54 changed files with 1381 additions and 74 deletions

View File

@@ -0,0 +1,75 @@
- name: "Download latest ClamAV Version to Control Node"
get_url:
url: https://www.clamav.net/downloads/production/clamav-{{ clamd_version }}.tar.gz
dest: "/tmp/clamav-{{ clamd_version }}.tar.gz"
delegate_to: localhost
- name: Copy ClamAV Tar from Control Node to Ansible Host
copy:
src: "/tmp/clamav-{{ clamd_version }}.tar.gz"
dest: "/usr/local/src/clamav-{{ clamd_version }}.tar.gz"
- name: "Extract ClamAV Tar on Ansible Host"
unarchive:
src: "/usr/local/src/clamav-{{ clamd_version }}.tar.gz"
dest: "/usr/local/src/"
remote_src: true
- name: "Create Build Folder in ClamAV Dir"
file:
path: "/usr/local/src/clamav-{{ clamd_version }}/build"
state: directory
- name: "Pin Cargo Regex Syntax Version"
args:
chdir: "/usr/local/src/clamav-{{ clamd_version }}/build"
shell: |
cargo update -p regex-syntax --precise 0.8.3
- name: "Cmake ClamAV"
args:
chdir: "/usr/local/src/clamav-{{ clamd_version }}/build"
shell: |
cmake .. -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_INSTALL_LIBDIR=lib -D APP_CONFIG_DIRECTORY=/etc/clamav -D DATABASE_DIRECTORY=/var/lib/clamav -D ENABLE_JSON_SHARED=OFF
- name: "Compile ClamAV"
args:
chdir: "/usr/local/src/clamav-{{ clamd_version }}/build"
shell: |
cmake --build .
- name: "Test Compiled ClamAV"
args:
chdir: "/usr/local/src/clamav-{{ clamd_version }}/build"
shell: |
ctest .
- name: "Install compiled ClamAV"
args:
chdir: "/usr/local/src/clamav-{{ clamd_version }}/build"
shell: |
cmake --build . --target install
- name: "Create Freshclam Log File"
file:
path: "/var/log/freshclam.log"
state: touch
owner: clamav
group: clamav
mode: '600'
- name: "Create ClamAV Log File"
file:
path: "/var/log/clamav.log"
state: touch
owner: clamav
group: clamav
mode: '600'
- name: "Set ClamAV Signature Database Permission"
file:
path: "/var/lib/clamav"
state: directory
owner: clamav
group: clamav
recurse: yes