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
3 changes: 3 additions & 0 deletions changelogs/fragments/logrotate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "orahost_logrotate: logrotate setup for oracle files should be optional (oravirt#449)"
13 changes: 9 additions & 4 deletions roles/orahost_logrotate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Configure logrotate for ansible-oracle
- [oracle_home_gi_cl](#oracle_home_gi_cl)
- [oracle_home_gi_so](#oracle_home_gi_so)
- [oracle_trace_cleanup_days](#oracle_trace_cleanup_days)
- [Discovered Tags](#discovered-tags)
- [orahost_logrotate_setup_logrotate](#orahost_logrotate_setup_logrotate)
- [Open Tasks](#open-tasks)
- [Dependencies](#dependencies)
- [License](#license)
Expand Down Expand Up @@ -108,11 +108,16 @@ Define number of days for ADR in Oracle.
oracle_trace_cleanup_days: 7
```

## Discovered Tags
### orahost_logrotate_setup_logrotate

**_cleanup_**
Setup of logrotate/cleanup is optional

#### Default value

```YAML
orahost_logrotate_setup_logrotate: true
```

**_logrotate_**

## Open Tasks

Expand Down
9 changes: 6 additions & 3 deletions roles/orahost_logrotate/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ oracle_home_gi: "{% if _oraswgi_meta_configure_cluster %}{{ oracle_home_gi_cl }}

# @var oracle_cleanup_days:description: >
# Define number of days for oracle_cleanup.sh logfiles and audit files.
# @dev
# @end
oracle_cleanup_days: 14

# @var oracle_trace_cleanup_days:description: >
# Define number of days for ADR in Oracle.
# @dev
# @end
oracle_trace_cleanup_days: 7

# @var logrotate_config:description: >
# Configuration of logrotate definitions.
# @dev
# @end
logrotate_config:
- name: oracle_alert
file: "{{ oracle_base }}/diag/rdbms/*/*/trace/*alert*.log {{ oracle_base }}/diag/asm/*/*/trace/alert*+ASM*.log"
Expand Down Expand Up @@ -44,3 +44,6 @@ logrotate_config:
- weekly
- rotate 24
- dateext

# @var orahost_logrotate_setup_logrotate:description: Setup of logrotate/cleanup is optional
orahost_logrotate_setup_logrotate: true
36 changes: 20 additions & 16 deletions roles/orahost_logrotate/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
---
# tasks file for orahost-logrotate

- name: Manage logrotate
ansible.builtin.template:
src: logrotate.j2
dest: "/etc/logrotate.d/{{ item.name }}"
mode: "0644"
with_items:
- "{{ logrotate_config }}"
when: logrotate_config is defined
tags: logrotate
- name: Setup logrotate
when: orahost_logrotate_setup_logrotate
block:

- name: Manage Cleanup-Scripts
ansible.builtin.template:
src: oracle_cleanup.j2
dest: /etc/cron.daily/oracle_cleanup.sh
mode: "0744"
when: logrotate_config is defined
tags: cleanup
- name: Manage logrotate
ansible.builtin.template:
src: logrotate.j2
dest: "/etc/logrotate.d/{{ item.name }}"
mode: "0644"
with_items:
- "{{ logrotate_config }}"
when: logrotate_config is defined
tags: logrotate

- name: Manage Cleanup-Scripts
ansible.builtin.template:
src: oracle_cleanup.j2
dest: /etc/cron.daily/oracle_cleanup.sh
mode: "0744"
when: logrotate_config is defined
tags: cleanup