diff --git a/defaults/main.yml b/defaults/main.yml index 556f3f05..012dfac4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -265,6 +265,7 @@ swift_account_server_replicator_conf_overrides: {} swift_container_server_conf_overrides: {} swift_container_reconciler_conf_overrides: {} swift_container_server_replicator_conf_overrides: {} +swift_drive_audit_conf_overrides: {} swift_object_server_conf_overrides: {} swift_object_expirer_conf_overrides: {} swift_object_server_replicator_conf_overrides: {} diff --git a/tasks/swift_storage_hosts_object.yml b/tasks/swift_storage_hosts_object.yml index a1325616..bf2656ee 100644 --- a/tasks/swift_storage_hosts_object.yml +++ b/tasks/swift_storage_hosts_object.yml @@ -131,3 +131,25 @@ when: > swift.replication_network is not defined or swift.replication_network == swift.storage_network + +- name: Deploy drive-audit configuration file + config_template: + src: drive-audit.conf.j2 + dest: /etc/swift/drive-audit.conf + owner: "{{ swift_system_user_name }}" + group: "{{ swift_system_group_name }}" + mode: "0644" + config_overrides: "{{ swift_drive_audit_conf_overrides }}" + config_type: "ini" + tags: + - swift-drive-audit + +- name: Create drive-audit cron job + cron: + name: "Run drive-audit script" + job: "{{ swift_venv_bin }}/swift-drive-audit /etc/swift/drive-audit.conf" + minute: 15 + cron_file: swift-drive-audit + user: root + tags: + - swift-drive-audit diff --git a/templates/drive-audit.conf.j2 b/templates/drive-audit.conf.j2 new file mode 100644 index 00000000..b4ee10ac --- /dev/null +++ b/templates/drive-audit.conf.j2 @@ -0,0 +1,11 @@ +# {{ ansible_managed }} + +[drive-audit] +device_dir = /srv/node +log_facility = LOG_LOCAL0 +log_level = INFO +minutes = 60 +error_limit = 2 +log_file_pattern = /var/log/kern* +regex_pattern_1 = \berror\b.*\b(sd[a-z]+([0-9]+)?)\b +regex_pattern_2 = \b(sd[a-z]+([0-9]+)?)\b.*\berror\b