Compare commits
10
Commits
b27d20fb52
...
10141cd792
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10141cd792
|
||
|
|
ce0a62bf1a | ||
|
|
a1f4fe279a | ||
|
|
df809ebfcd | ||
|
|
2f51a6e523 | ||
|
|
887e4403a2 | ||
|
|
4716624228 | ||
|
|
0504d2d5af | ||
|
|
96cda3f1d4 | ||
|
|
8ef1897517 |
+36
-2
@@ -39,12 +39,14 @@ reviews:
|
||||
mode: "warning"
|
||||
requirements: |
|
||||
PR title MUST follow Conventional Commits format:
|
||||
- Format: <type>: <description> or <type>!: <description> for breaking changes
|
||||
- Valid types: Refer to the 'type-enum' rule in .commitlintrc.js file for the complete list of allowed types
|
||||
- Format: <required type><optional (scope)><optional !>: <required description>
|
||||
- Valid types: Refer to https://github.com/linux-system-roles/auto-maintenance/blob/main/pr_title_lint.py#L23
|
||||
- Examples:
|
||||
- "feat: Add backup functionality"
|
||||
- "fix: Correct OSTree package installation"
|
||||
- "fix!: Remove deprecated variable (breaking change)"
|
||||
- "chore(formatting): Fix indentation in my_module.py"
|
||||
- "refactor(python)!: Use new python library thispy which has breaking api changes"
|
||||
|
||||
custom_checks:
|
||||
- mode: "warning"
|
||||
@@ -55,6 +57,8 @@ reviews:
|
||||
- Must contain "Reason:" section explaining why the change was needed
|
||||
- Must contain "Result:" section describing the outcome or impact
|
||||
- Can contain optional "Issue Tracker Tickets (Jira or BZ if any):" section
|
||||
- Must contain "Signed-off-by:" section with your name and email address - use git commit -s
|
||||
- Can contain optional "Assisted-by:" section with name of the AI coding assistant and models used
|
||||
|
||||
Example:
|
||||
```
|
||||
@@ -65,6 +69,34 @@ reviews:
|
||||
Result: Users can now set aide_secure_logging: false for debugging while maintaining secure defaults.
|
||||
|
||||
Issue Tracker Tickets (Jira or BZ if any): RHEL-12345
|
||||
|
||||
Signed-off-by: John Doe john.doe@example.com
|
||||
|
||||
Assisted-by: Fish 4.3 using model Swim 6.2
|
||||
```
|
||||
|
||||
For PRs that are bug fixes, you can use the following template:
|
||||
- Must contain "Cause:" section explaining the root cause of the bug
|
||||
- Must contain "Consequences:" section explaining the impact of the bug and how it appears to users
|
||||
- Must contain "Fix:" section explaining the fix for the bug and how it fixes the bug
|
||||
- Must contain "Result:" section describing the outcome or impact of the fix
|
||||
- Can contain optional "Issue Tracker Tickets (Jira or BZ if any):" section
|
||||
- Must contain "Signed-off-by:" section with your name and email address - use git commit -s
|
||||
- Can contain optional "Assisted-by:" section with name of the AI coding assistant and models used
|
||||
|
||||
Example:
|
||||
```
|
||||
Cause: The variable rolename_user_name was being checked for a `none` value but was not being checked for string length greater than 0 if a string.
|
||||
|
||||
Consequences: The role allowed empty user names to be configured which caused the daemon to report "User not found".
|
||||
|
||||
Fix: The variable rolename_user_name is now checked for string length if not `none`, and will report an error in that case if the length is 0.
|
||||
|
||||
Result: The role will not allow the user to provide an empty user name and will report an error if the rolename_user_name length is 0.
|
||||
|
||||
Signed-off-by: John Doe john.doe@example.com
|
||||
|
||||
Assisted-by: Fish 4.3 using model Swim 6.2
|
||||
```
|
||||
|
||||
path_instructions:
|
||||
@@ -180,6 +212,8 @@ reviews:
|
||||
- Tests should verify both success and failure scenarios
|
||||
- Use assert module to verify expected state after role execution
|
||||
- Include cleanup tasks to ensure tests are rerunnable
|
||||
- Tests should be run in a block with an always section that runs the test cleanup to ensure that the cleanup is always run.
|
||||
- The cleanup tasks should be tagged with `tests::cleanup` so that the cleanup can be skipped for debug purposes.
|
||||
- Tests should be idempotent - running twice should not cause failures
|
||||
- Example verification:
|
||||
```yaml
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
module.exports = {
|
||||
parserPreset: 'conventional-changelog-conventionalcommits',
|
||||
rules: {
|
||||
'body-leading-blank': [1, 'always'],
|
||||
'body-max-line-length': [2, 'always', 100],
|
||||
'footer-leading-blank': [1, 'always'],
|
||||
'footer-max-line-length': [2, 'always', 100],
|
||||
'header-max-length': [2, 'always', 100],
|
||||
'subject-case': [
|
||||
2,
|
||||
'never',
|
||||
['start-case', 'pascal-case', 'upper-case'],
|
||||
],
|
||||
'subject-empty': [2, 'never'],
|
||||
'subject-full-stop': [2, 'never', '.'],
|
||||
'type-case': [2, 'always', 'lower-case'],
|
||||
'type-empty': [2, 'never'],
|
||||
'type-enum': [
|
||||
2,
|
||||
'always',
|
||||
[
|
||||
'build',
|
||||
'chore',
|
||||
'ci',
|
||||
'docs',
|
||||
'feat',
|
||||
'fix',
|
||||
'perf',
|
||||
'refactor',
|
||||
'revert',
|
||||
'style',
|
||||
'test',
|
||||
'tests',
|
||||
],
|
||||
],
|
||||
},
|
||||
prompt: {
|
||||
questions: {
|
||||
type: {
|
||||
description: "Select the type of change that you're committing",
|
||||
enum: {
|
||||
feat: {
|
||||
description: 'A new feature',
|
||||
title: 'Features',
|
||||
emoji: '✨',
|
||||
},
|
||||
fix: {
|
||||
description: 'A bug fix',
|
||||
title: 'Bug Fixes',
|
||||
emoji: '🐛',
|
||||
},
|
||||
docs: {
|
||||
description: 'Documentation only changes',
|
||||
title: 'Documentation',
|
||||
emoji: '📚',
|
||||
},
|
||||
style: {
|
||||
description:
|
||||
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
|
||||
title: 'Styles',
|
||||
emoji: '💎',
|
||||
},
|
||||
refactor: {
|
||||
description:
|
||||
'A code change that neither fixes a bug nor adds a feature',
|
||||
title: 'Code Refactoring',
|
||||
emoji: '📦',
|
||||
},
|
||||
perf: {
|
||||
description: 'A code change that improves performance',
|
||||
title: 'Performance Improvements',
|
||||
emoji: '🚀',
|
||||
},
|
||||
test: {
|
||||
description: 'Adding missing tests or correcting existing tests',
|
||||
title: 'Tests',
|
||||
emoji: '🚨',
|
||||
},
|
||||
tests: {
|
||||
description: 'Adding missing tests or correcting existing tests',
|
||||
title: 'Tests',
|
||||
emoji: '🚨',
|
||||
},
|
||||
build: {
|
||||
description:
|
||||
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
|
||||
title: 'Builds',
|
||||
emoji: '🛠',
|
||||
},
|
||||
ci: {
|
||||
description:
|
||||
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
|
||||
title: 'Continuous Integrations',
|
||||
emoji: '⚙️',
|
||||
},
|
||||
chore: {
|
||||
description: "Other changes that don't modify src or test files",
|
||||
title: 'Chores',
|
||||
emoji: '♻️',
|
||||
},
|
||||
revert: {
|
||||
description: 'Reverts a previous commit',
|
||||
title: 'Reverts',
|
||||
emoji: '🗑',
|
||||
},
|
||||
},
|
||||
},
|
||||
scope: {
|
||||
description:
|
||||
'What is the scope of this change (e.g. component or file name)',
|
||||
},
|
||||
subject: {
|
||||
description:
|
||||
'Write a short, imperative tense description of the change',
|
||||
},
|
||||
body: {
|
||||
description: 'Provide a longer description of the change',
|
||||
},
|
||||
isBreaking: {
|
||||
description: 'Are there any breaking changes?',
|
||||
},
|
||||
breakingBody: {
|
||||
description:
|
||||
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
|
||||
},
|
||||
breaking: {
|
||||
description: 'Describe the breaking changes',
|
||||
},
|
||||
isIssueAffected: {
|
||||
description: 'Does this change affect any open issues?',
|
||||
},
|
||||
issuesBody: {
|
||||
description:
|
||||
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
|
||||
},
|
||||
issues: {
|
||||
description: 'Add issue references (e.g. "fix #123", "re #123".)',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
- name: Install tox, tox-lsr
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.18.1"
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
- name: Install tox, tox-lsr
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.18.1"
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
|
||||
|
||||
- name: Run ansible-plugin-scan
|
||||
run: |
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Install tox, tox-lsr
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.18.1"
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
|
||||
@@ -22,11 +22,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install conventional-commit linter
|
||||
run: npm install @commitlint/config-conventional @commitlint/cli
|
||||
- name: Install pr_title_lint.py
|
||||
run: curl -o pr_title_lint.py https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/main/pr_title_lint.py
|
||||
|
||||
- name: Run commitlint on PR title
|
||||
- name: Run pr_title_lint.py on PR title
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
# Echo from env variable to avoid bash errors with extra characters
|
||||
run: echo "$PR_TITLE" | npx commitlint --verbose
|
||||
run: python3 pr_title_lint.py "${PR_TITLE}"
|
||||
|
||||
@@ -30,8 +30,8 @@ jobs:
|
||||
# QEMU
|
||||
- { image: "centos-9", env: "qemu-ansible-core-2-16" }
|
||||
- { image: "centos-10", env: "qemu-ansible-core-2-17" }
|
||||
- { image: "fedora-42", env: "qemu-ansible-core-2-19" }
|
||||
- { image: "fedora-43", env: "qemu-ansible-core-2-20" }
|
||||
- { image: "fedora-44", env: "qemu-ansible-core-2-21" }
|
||||
- { image: "leap-15.6", env: "qemu-ansible-core-2-18" }
|
||||
|
||||
# container
|
||||
@@ -40,10 +40,11 @@ jobs:
|
||||
# broken on non-running dbus
|
||||
# - { image: "centos-10", env: "container-ansible-core-2-17" }
|
||||
- { image: "centos-10-bootc", env: "container-ansible-core-2-17" }
|
||||
- { image: "fedora-42", env: "container-ansible-core-2-17" }
|
||||
- { image: "fedora-43", env: "container-ansible-core-2-20" }
|
||||
- { image: "fedora-42-bootc", env: "container-ansible-core-2-17" }
|
||||
- { image: "fedora-44", env: "container-ansible-core-2-21" }
|
||||
- { image: "fedora-43-bootc", env: "container-ansible-core-2-20" }
|
||||
# ansible-core 2.21 cannot enable services using service module in bootc images
|
||||
- { image: "fedora-44-bootc", env: "container-ansible-core-2-20" }
|
||||
|
||||
env:
|
||||
TOX_ARGS: "--skip-tags tests::infiniband,tests::nvme,tests::scsi"
|
||||
@@ -110,29 +111,24 @@ jobs:
|
||||
python3 -m pip install --upgrade pip
|
||||
sudo apt update
|
||||
sudo apt install -y --no-install-recommends git ansible-core genisoimage qemu-system-x86
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.18.1"
|
||||
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
|
||||
|
||||
# HACK: Drop this when moving this workflow to 26.04 LTS
|
||||
- name: Update podman to 5.x for compatibility with bootc-image-builder's podman 5
|
||||
if: steps.check_platform.outputs.supported && endsWith(matrix.scenario.image, '-bootc')
|
||||
- name: Check for podman version 5 or higher
|
||||
id: check_podman_version
|
||||
if: steps.check_platform.outputs.supported
|
||||
run: |
|
||||
sed 's/noble/plucky/g' /etc/apt/sources.list.d/ubuntu.sources | sudo tee /etc/apt/sources.list.d/plucky.sources >/dev/null
|
||||
cat <<EOF | sudo tee /etc/apt/preferences.d/podman.pref >/dev/null
|
||||
Package: podman buildah golang-github-containers-common crun libgpgme11t64 libgpg-error0 golang-github-containers-image catatonit conmon containers-storage
|
||||
Pin: release n=plucky
|
||||
Pin-Priority: 991
|
||||
podman_version=$(podman version -f '{{.Client.Version}}')
|
||||
podman_major_version="${podman_version%%.*}"
|
||||
echo "Podman version: $podman_version"
|
||||
if [ "$podman_major_version" -lt 5 ]; then
|
||||
echo "need_podman_update=1" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "need_podman_update=0" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
Package: libsubid4 netavark passt aardvark-dns containernetworking-plugins libslirp0 slirp4netns
|
||||
Pin: release n=plucky
|
||||
Pin-Priority: 991
|
||||
|
||||
Package: *
|
||||
Pin: release n=plucky
|
||||
Pin-Priority: 400
|
||||
EOF
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y podman crun conmon containers-storage
|
||||
- name: Ensure use of podman 5
|
||||
if: steps.check_platform.outputs.supported && steps.check_podman_version.outputs.need_podman_update == 1
|
||||
uses: redhat-actions/podman-install@main
|
||||
|
||||
- name: Configure tox-lsr
|
||||
if: steps.check_platform.outputs.supported
|
||||
|
||||
@@ -72,8 +72,8 @@ jobs:
|
||||
meta_main=meta/main.yml
|
||||
# All Fedora are supported, add latest Fedora versions to supported_platforms
|
||||
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qi fedora$; then
|
||||
supported_platforms+=" Fedora-42"
|
||||
supported_platforms+=" Fedora-43"
|
||||
supported_platforms+=" Fedora-44"
|
||||
fi
|
||||
# Specific Fedora versions supported
|
||||
if yq '.galaxy_info.galaxy_tags[]' "$meta_main" | grep -qiP 'fedora\d+$'; then
|
||||
@@ -99,10 +99,10 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
# Ensure ansible version is a string!
|
||||
- platform: Fedora-42
|
||||
ansible_version: "2.19"
|
||||
- platform: Fedora-43
|
||||
ansible_version: "2.20"
|
||||
- platform: Fedora-44
|
||||
ansible_version: "2.21"
|
||||
- platform: CentOS-7-latest
|
||||
ansible_version: "2.9"
|
||||
- platform: CentOS-Stream-8
|
||||
|
||||
@@ -15,6 +15,9 @@ aide_init: false
|
||||
# Fetch db
|
||||
aide_fetch_db: false
|
||||
|
||||
# Upload db
|
||||
aide_upload_db: false
|
||||
|
||||
# Enable check database phase
|
||||
aide_check: false
|
||||
|
||||
|
||||
+144
-122
@@ -10,137 +10,159 @@
|
||||
state: present
|
||||
use: "{{ (__aide_is_ostree | d(false)) |
|
||||
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
|
||||
register: __aide_install_packages
|
||||
|
||||
- name: Get AIDE version
|
||||
ansible.builtin.command:
|
||||
cmd: aide --version
|
||||
register: __aide_version_register
|
||||
changed_when: false
|
||||
|
||||
# assumes the version starts with a digit and goes to the end of the line
|
||||
- name: Set AIDE version
|
||||
set_fact:
|
||||
aide_version: "{{ __output | regex_search('(?m)^A[iI][dD][eE] (\\d.*)$', '\\1') | first }}"
|
||||
vars:
|
||||
__output: "{{ __aide_version_register.stdout if __aide_version_register.stdout | length > 0
|
||||
else __aide_version_register.stderr }}"
|
||||
|
||||
- name: Ensure required services are enabled and started
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
loop: "{{ __aide_services }}"
|
||||
|
||||
- name: Generate "/etc/{{ __aide_config }}"
|
||||
ansible.builtin.template:
|
||||
src: "{{ aide_config_template }}"
|
||||
dest: "/etc/{{ __aide_config }}"
|
||||
mode: "0400"
|
||||
when: aide_config_template is not none
|
||||
|
||||
# - name: Print Header
|
||||
# ansible.builtin.command: head /etc/aide.conf || true
|
||||
|
||||
- name: Initialize AIDE database
|
||||
when: aide_init | bool
|
||||
- name: Packages are installed
|
||||
# either run mode or check mode and no changes to packages
|
||||
when: not ansible_check_mode or (ansible_check_mode and not __aide_install_packages.changed)
|
||||
block:
|
||||
- name: Initialize AIDE database
|
||||
- name: Get AIDE version
|
||||
ansible.builtin.command:
|
||||
cmd: aide --init
|
||||
changed_when: true
|
||||
|
||||
- name: Copy AIDE reference database
|
||||
ansible.builtin.copy:
|
||||
remote_src: true
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ __aide_db_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
force: true
|
||||
when: not aide_fetch_db | bool
|
||||
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
state: absent
|
||||
when: not aide_fetch_db | bool
|
||||
|
||||
- name: Fetch AIDE database
|
||||
when: aide_fetch_db | bool
|
||||
block:
|
||||
- name: Fetch AIDE database
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ aide_db_fetch_dir }}"
|
||||
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
state: absent
|
||||
|
||||
- name: Check AIDE integrity
|
||||
when: aide_check | bool
|
||||
block:
|
||||
- name: Copy AIDE reference database
|
||||
ansible.builtin.copy:
|
||||
src: >-
|
||||
{{ aide_db_fetch_dir }}/{{ inventory_hostname }}{{ __aide_db_new_name }}
|
||||
dest: "{{ __aide_db_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
when: aide_fetch_db | bool
|
||||
|
||||
- name: Check against AIDE reference database
|
||||
ansible.builtin.command:
|
||||
cmd: aide --check
|
||||
cmd: aide --version
|
||||
check_mode: false
|
||||
register: __aide_version_register
|
||||
changed_when: false
|
||||
|
||||
- name: Update AIDE database and fetch it
|
||||
when: aide_update | bool
|
||||
block:
|
||||
- name: Update AIDE database
|
||||
ansible.builtin.command:
|
||||
cmd: aide --update
|
||||
register: __aide_update_result
|
||||
failed_when: __msg not in __aide_update_result.stdout
|
||||
changed_when: true
|
||||
# assumes the version starts with a digit and goes to the end of the line
|
||||
- name: Set AIDE version
|
||||
set_fact:
|
||||
aide_version: "{{ __output | regex_search('(?m)^A[iI][dD][eE] (\\d.*)$', '\\1') | first }}"
|
||||
vars:
|
||||
__msg: >-
|
||||
AIDE found NO differences between database and filesystem. Looks okay!!
|
||||
__output: "{{ __aide_version_register.stdout if __aide_version_register.stdout | length > 0
|
||||
else __aide_version_register.stderr }}"
|
||||
|
||||
- name: Ensure required services are enabled and started
|
||||
ansible.builtin.service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
loop: "{{ __aide_services }}"
|
||||
|
||||
- name: Generate "/etc/{{ __aide_config }}"
|
||||
ansible.builtin.template:
|
||||
src: "{{ aide_config_template }}"
|
||||
dest: "/etc/{{ __aide_config }}"
|
||||
mode: "0400"
|
||||
when: aide_config_template is not none
|
||||
|
||||
# - name: Print Header
|
||||
# ansible.builtin.command: head /etc/aide.conf || true
|
||||
|
||||
- name: Initialize AIDE database
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- aide_init | bool
|
||||
block:
|
||||
- name: Initialize AIDE database
|
||||
ansible.builtin.command:
|
||||
cmd: aide --init
|
||||
changed_when: true
|
||||
|
||||
- name: Copy AIDE reference database
|
||||
ansible.builtin.copy:
|
||||
remote_src: true
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ __aide_db_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
force: true
|
||||
when: not aide_fetch_db | bool
|
||||
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
state: absent
|
||||
when: not aide_fetch_db | bool
|
||||
|
||||
- name: Fetch AIDE database
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ aide_db_fetch_dir }}"
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- aide_fetch_db | bool
|
||||
block:
|
||||
- name: Fetch AIDE database
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ aide_db_fetch_dir }}"
|
||||
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
state: absent
|
||||
|
||||
- name: Check AIDE integrity
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- aide_check | bool
|
||||
block:
|
||||
- name: Copy AIDE reference database
|
||||
ansible.builtin.copy:
|
||||
src: >-
|
||||
{{ aide_db_fetch_dir }}/{{ inventory_hostname }}{{ __aide_db_new_name }}
|
||||
dest: "{{ __aide_db_name }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
when: aide_upload_db | bool
|
||||
|
||||
- name: Check against AIDE reference database
|
||||
ansible.builtin.command:
|
||||
cmd: aide --check
|
||||
changed_when: false
|
||||
|
||||
- name: Update AIDE database and fetch it
|
||||
when:
|
||||
- not ansible_check_mode
|
||||
- aide_update | bool
|
||||
block:
|
||||
- name: Update AIDE database
|
||||
ansible.builtin.command:
|
||||
cmd: aide --update
|
||||
register: __aide_update_result
|
||||
failed_when: __msg not in __aide_update_result.stdout
|
||||
changed_when: true
|
||||
vars:
|
||||
__msg: >-
|
||||
AIDE found NO differences between database and filesystem. Looks okay!!
|
||||
|
||||
- name: Fetch AIDE database
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ __aide_db_new_name }}"
|
||||
dest: "{{ aide_db_fetch_dir }}"
|
||||
|
||||
- name: Remove remote AIDE database file
|
||||
ansible.builtin.file:
|
||||
path: "{{ __aide_db_new_name }}"
|
||||
state: absent
|
||||
|
||||
- name: Update aide check cron configuration if necessary
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/crontab
|
||||
regexp: "^.* root {{ __aide_bin_path }} --check"
|
||||
line: "{{ aide_cron_interval }} root {{ __aide_bin_path }} --check"
|
||||
when:
|
||||
- aide_cron_check is not none
|
||||
- aide_cron_check | bool
|
||||
|
||||
- name: Remove aide check cron configuration if necessary
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/crontab
|
||||
state: absent
|
||||
regexp: "^.* root {{ __aide_bin_path }} --check"
|
||||
when:
|
||||
- aide_cron_check is not none
|
||||
- not aide_cron_check | bool
|
||||
|
||||
- name: Update aide check cron configuration if necessary
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/crontab
|
||||
regexp: "^.* root {{ __aide_bin_path }} --check"
|
||||
line: "{{ aide_cron_interval }} root {{ __aide_bin_path }} --check"
|
||||
when:
|
||||
- aide_cron_check is not none
|
||||
- aide_cron_check | bool
|
||||
- name: Fetch AIDE logs
|
||||
ansible.builtin.fetch:
|
||||
src: "/var/log/aide/aide.log"
|
||||
dest: "{{ aide_db_fetch_dir }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0640"
|
||||
|
||||
- name: Remove aide check cron configuration if necessary
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/crontab
|
||||
state: absent
|
||||
regexp: "^.* root {{ __aide_bin_path }} --check"
|
||||
when:
|
||||
- aide_cron_check is not none
|
||||
- not aide_cron_check | bool
|
||||
|
||||
- name: Record role success fingerprint
|
||||
sr_fingerprint:
|
||||
sr_message: >-
|
||||
success system_role:aide ansible_version={{ ansible_version.full }}
|
||||
{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}
|
||||
- name: Record role success fingerprint
|
||||
sr_fingerprint:
|
||||
sr_message: >-
|
||||
success system_role:aide ansible_version={{ ansible_version.full }}
|
||||
{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}
|
||||
|
||||
Reference in New Issue
Block a user