Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,30 @@
{{% endif %}}
state: present

- name: "Gather list of installed packages"
ansible.builtin.package_facts:
manager: auto

{{% if product != 'ubuntu2404' %}}
- name: "{{{ rule_title }}}"
ansible.builtin.cron:
{{% if product in ["sle12", "sle15"] %}}
{{% if product in ["sle12", "sle15", "sle16"] %}}
name: "{{{ rule_title }}}"
cron_file: /etc/crontab
cron_file: /etc/cron.d/dailyaidecheck
{{% else %}}
name: "run AIDE check"
{{% endif %}}
minute: 05
hour: 04
weekday: 0
user: root
job: "{{{ aide_bin_path }}} --check"
register: crontab_check
{{% if "ubuntu" in product or "debian" in product %}}
when: "'cron' in ansible_facts.packages"
{{% else %}}
when: "'cronie' in ansible_facts.packages"
{{% endif %}}

{{% else %}}
- name: "{{{ rule_title }}} - Install AIDE Cron Job"
ansible.builtin.lineinfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@

{{{ bash_package_install("aide") }}}

if ! grep -q "{{{ aide_bin_path }}} --check" /etc/crontab ; then
echo "05 4 * * * root {{{ aide_bin_path }}} --check" >> /etc/crontab
{{% if "ubuntu" in product or "debian" in product %}}
{{{ bash_package_install("cron") }}}
{{% else %}}
{{{ bash_package_install("cronie") }}}
{{% endif %}}

{{% if product in ["sle15", "sle16"] %}}
CRON_FILE="/etc/cron.d/dailyaidecheck"
{{% else %}}
CRON_FILE="/etc/crontab"
{{% endif %}}

if ! grep -q "{{{ aide_bin_path }}} --check" "${CRON_FILE}" ; then
echo "05 4 * * * root {{{ aide_bin_path }}} --check" >> "${CRON_FILE}"
else
sed -i '\!^.*{{{ aide_bin_dir }}} --check.*$!d' /etc/crontab
echo "05 4 * * * root {{{ aide_bin_path }}} --check" >> /etc/crontab
sed -i '\!^.*{{{ aide_bin_dir }}} --check.*$!d' "${CRON_FILE}"
echo "05 4 * * * root {{{ aide_bin_path }}} --check" >> "${CRON_FILE}"
fi
Loading