committed by
Sergei Petrosian
parent
24f5af0f92
commit
e9ddf8804c
@@ -87,9 +87,10 @@ Type: `bool`
|
|||||||
|
|
||||||
### aide_cron_check
|
### aide_cron_check
|
||||||
|
|
||||||
Set up periodic cron check for aide
|
If set to `true`, configures periodic cron check for aide
|
||||||
|
If set to `false`, removes the periodic cron check
|
||||||
|
|
||||||
Default: `false`
|
Default: `null`
|
||||||
|
|
||||||
Type: `bool`
|
Type: `bool`
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ aide_check: false
|
|||||||
aide_update: false
|
aide_update: false
|
||||||
|
|
||||||
# Enable periodic check
|
# Enable periodic check
|
||||||
aide_cron_check: false
|
aide_cron_check: null
|
||||||
|
|
||||||
# Example of job definition:
|
# Example of job definition:
|
||||||
# .---------------- minute (0 - 59)
|
# .---------------- minute (0 - 59)
|
||||||
|
|||||||
@@ -10,6 +10,5 @@
|
|||||||
aide_fetch_db: false
|
aide_fetch_db: false
|
||||||
aide_check: false
|
aide_check: false
|
||||||
aide_update: false
|
aide_update: false
|
||||||
aide_cron_check: false
|
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: linux-system-roles.aide
|
name: linux-system-roles.aide
|
||||||
|
|||||||
+6
-2
@@ -110,11 +110,15 @@
|
|||||||
path: /etc/crontab
|
path: /etc/crontab
|
||||||
regexp: "^.* root /usr/sbin/aide --check"
|
regexp: "^.* root /usr/sbin/aide --check"
|
||||||
line: "{{ aide_cron_interval }} root /usr/sbin/aide --check"
|
line: "{{ aide_cron_interval }} root /usr/sbin/aide --check"
|
||||||
when: aide_cron_check | bool
|
when:
|
||||||
|
- aide_cron_check is not none
|
||||||
|
- aide_cron_check | bool
|
||||||
|
|
||||||
- name: Remove aide check cron configuration if necessary
|
- name: Remove aide check cron configuration if necessary
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/crontab
|
path: /etc/crontab
|
||||||
state: absent
|
state: absent
|
||||||
regexp: "^.* root /usr/sbin/aide --check"
|
regexp: "^.* root /usr/sbin/aide --check"
|
||||||
when: not aide_cron_check | bool
|
when:
|
||||||
|
- aide_cron_check is not none
|
||||||
|
- not aide_cron_check | bool
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
---
|
---
|
||||||
- name: Ensure that the cron is set up
|
- name: Ensure that the cron is set up
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: false # test that role works in this case
|
gather_facts: false
|
||||||
roles:
|
roles:
|
||||||
- role: linux-system-roles.aide
|
- role: linux-system-roles.aide
|
||||||
vars:
|
vars:
|
||||||
@@ -10,12 +10,38 @@
|
|||||||
aide_cron_check: true
|
aide_cron_check: true
|
||||||
aide_cron_interval: "0 12 * * *"
|
aide_cron_interval: "0 12 * * *"
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Print crontab 1
|
||||||
|
ansible.builtin.shell: cat /etc/crontab
|
||||||
|
|
||||||
- name: Check file content
|
- name: Check file content
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/crontab
|
path: /etc/crontab
|
||||||
regexp: "^0 12 \\* \\* \\* root /usr/bin/aide --check"
|
regexp: "^.* root /usr/sbin/aide --check"
|
||||||
state: absent
|
line: "0 12 * * * root /usr/sbin/aide --check"
|
||||||
check_mode: true
|
state: present
|
||||||
changed_when: false
|
register: result
|
||||||
|
failed_when: result.changed
|
||||||
|
vars:
|
||||||
|
__fingerprint: system_role:aide
|
||||||
|
|
||||||
|
- name: Ensure that the cron is not set up
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- role: linux-system-roles.aide
|
||||||
|
vars:
|
||||||
|
aide_cron_check: false
|
||||||
|
tasks:
|
||||||
|
- name: Print crontab 2
|
||||||
|
ansible.builtin.shell: cat /etc/crontab
|
||||||
|
|
||||||
|
- name: Check file content
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/crontab
|
||||||
|
regexp: "^.* root /usr/sbin/aide --check"
|
||||||
|
line: "0 12 * * * root /usr/sbin/aide --check"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
failed_when: not result.changed
|
||||||
vars:
|
vars:
|
||||||
__fingerprint: system_role:aide
|
__fingerprint: system_role:aide
|
||||||
|
|||||||
Reference in New Issue
Block a user