Wrong cron template in ansiblerole-foreman_scap_client-0.5.0-1.el9.noarch

Problem:

I have a Foreman instance running on EL9.
After run the Foreman SCAP role on the EL8 hosts (clients), the cron job didn’t send the report back.
I checked it and found that the client on OL8 couldn’t send the report due to an incorrect syntax in the cron for /usr/bin/foreman_scap_client:

# cat /etc/cron.d/foreman_scap_client_cron 
# DO NOT EDIT THIS FILE MANUALLY
# IT IS MANAGED BY ANSIBLE
# ANY MANUAL CHANGES WILL BE LOST ON THE NEXT ANSIBLE EXECUTION
#
# Executing foreman_scap_client from command line may be useful for debugging purposes.

# foreman_scap_client cron job
0 1 * * 3 root /bin/sleep 523; /usr/bin/foreman_scap_client ds 6 2>&1 | logger -t foreman_scap_client

In journalctl i see exacly the reason - wrong syntax:

# journalctl -t foreman_scap_client
-- Logs begin at Tue 2024-09-17 13:08:36 CEST, end at Wed 2026-10-28 12:06:59 CET. --
Oct 28 01:04:25 DEVX foreman_scap_client[65500]: Usage: /usr/bin/foreman_scap_client policy_id
Oct 28 01:04:25 DEVX foreman_scap_client[65500]:   where policy_id is a key used in config file

I ran the command manually, and it executes without the “ds” parameter.

# /usr/bin/foreman_scap_client 6 
DEBUG: running: oscap xccdf eval  --profile xccdf_org.cisecurity.benchmarks_profile_Level_1_-_Server  --results-arf /tmp/d20261028-256992-zdjym2/results.xml /var/lib/openscap/content/60398f0aad46d47dff7434c9447391077b02f0a8ec7706d40ce174dd60e1e3ae.xml
DEBUG: running: /usr/bin/env bzip2 /tmp/d20261028-256992-zdjym2/results.xml
Uploading results to https://proxy1.foreman.x.pl:9090/compliance/arf/6
Report uploaded, report id: 44956034

Program foreman_scap_client was delivered by rpm:

# rpm -qf /usr/bin/foreman_scap_client
rubygem-foreman_scap_client-0.4.6-1.el8.noarch

From the Foreman EL9 perspective the cron was delivered by ansible role from package:

# rpm -qf /usr/share/ansible/roles/theforeman.foreman_scap_client/templates/cron.j2 
ansiblerole-foreman_scap_client-0.5.0-1.el9.noarch

Cron template looks like:

$ cat /usr/share/ansible/roles/theforeman.foreman_scap_client/templates/cron.j2
# DO NOT EDIT THIS FILE MANUALLY
# IT IS MANAGED BY ANSIBLE
# ANY MANUAL CHANGES WILL BE LOST ON THE NEXT ANSIBLE EXECUTION
#
# Executing foreman_scap_client from command line may be useful for debugging purposes.

# foreman_scap_client cron job
{% for policy in foreman_scap_client_policies %}
{{ policy['minute'] }} {{ policy['hour'] }} {{ policy['monthday'] }} {{ policy['month'] }} {{ policy['weekday'] }} root /bin/sleep {{ foreman_scap_client_cron_splay | random(seed = foreman_scap_client_cron_splay_seed) if foreman_scap_client_cron_splay_seed != '' else foreman_scap_client_cron_splay | random }}; /usr/bin/foreman_scap_client ds {{ policy['id'] }} 2>&1 | logger -t foreman_scap_client
{% endfor %}

Expected outcome:

Working cron syntax.

Foreman and Proxy versions: 3.18.2

Foreman and Proxy plugin versions: 3.18 (the same version is in the 3.19)

I would argue not the cron syntax is wrong, but the client package is too old. Can you look into your repository configuration? Probably this is pointing to an older version for the client repository than you have installed on the server.