Hello, I am new to Ansible and currently writing my first playbook with the purpose of installing and configuring clamav on a list of servers. Note I am using $localhost for testing. Here is the script:
- name: Install clamav
hosts: localhost
become: yes
tasks:
name: Package installation
ansible.builtin.yum:
name:
clamav-server
clamav-data
clamav-update
clamav-filesystem
clamav
clamav-scanner-systemd
clamav-devel
clamav-lib
clamav-server-systemd
state: latestname: Set antivirus_can_scan_system on and keep it persistent across reboots
ansible.posix.seboolean:
name: antivirus_can_scan_system
state: yes
persistent: yesname: Set clamd_use_jit on and keep it persistent across reboots
ansible.posix.seboolean:
name: clamd_use_jit
state: yes
persistent: yesname: Edit the configuration file
lineinfile:
path: /etc/clamd.d/scan.conf
regexp: '#(\s+)LocalSocket /var/run/clamd.scan/clamd.sock'
replace: 'LocalSocket /var/run/clamd.scan/clamd.sock'
backup: yesname: Remove from configuration file
lineinfile:
path: /etc/clamd.d/scan.conf
regexp: '#(\s+)Example'
replace: 'Example'
backup: yesname: Edit freshclam configuration file
lineinfile:
path: /etc/freshclam.conf
regexp: '#(\s+)Example'
replace: 'Example'
backup: yesname: Enable Freshclam
ansible.builtin.service:
name: freshclam
state: started
enabled: yesname: Ensure ClamAv service is started and enabled
ansible.builtin.service:
name: clamd@scan
state: started
enabled: yes
...
I get the following when I try to run the playbook:
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match 'all'
ERROR! couldn't resolve module/action 'ansible.posix.seboolean'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/etc/ansible/kc_first_playbook.yml': line 21, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Set antivirus_can_scan_system on and keep it persistent across reboots
^ here
Any help on this will be appreciated. Thanks!