-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean log files before snapshot restore
Signed-off-by: Florent CARLI <[email protected]>
- Loading branch information
1 parent
927853c
commit 793111b
Showing
6 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Cleanup /var/log/ Role | ||
|
||
This role removes the content of the /var/log/ folder | ||
|
||
## Requirements | ||
|
||
no requirement. | ||
|
||
## Role Variables | ||
|
||
no variable. | ||
|
||
## Example Playbook | ||
|
||
```yaml | ||
- name: Cleanup /var/log/ folder | ||
hosts: cluster_machines | ||
become: true | ||
roles: | ||
- { role: seapath_ansible.ci_cleanup_varlog } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (C) 2024 RTE | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--- | ||
- name: Wipe the /var/log/ directory content | ||
shell: rm -rf /var/log/* | ||
changed_when: true | ||
args: | ||
warn: false | ||
|
||
- name: Recreate useful folders (1) | ||
file: | ||
path: "{{ item }}" | ||
state: directory | ||
mode: 0755 | ||
loop: | ||
- /var/log/audit | ||
- /var/log/openvswitch | ||
- /var/log/nginx | ||
|
||
- name: Check if hacluster user exists | ||
command: getent passwd hacluster | ||
register: hacluster_check | ||
changed_when: false | ||
failed_when: hacluster_check.rc not in [0, 2] | ||
|
||
- name: Recreate useful folders /var/log/crmsh/ (2) | ||
file: | ||
path: /var/log/crmsh/ | ||
state: directory | ||
mode: 0755 | ||
owner: hacluster | ||
group: haclient | ||
when: hacluster_check.rc == 0 |