Rotate cephadm_command.log

Before calling cephadm playbook, check if the log file
cephadm_command.log exists (from a previous run).
If it does, then rename it to append a timestamp. When
cephadm is run, a new log will be created.

Change-Id: Ia0a2c46eb84e43c9c69fd5a087bfd4bcc687fd95
Resolves: rhbz#2149339
This commit is contained in:
katarimanoj 2022-12-12 23:47:55 +05:30
parent 07b2333cfb
commit 35155b9230
1 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,15 @@
- '-e @{{ playbook_dir }}/cephadm/cephadm-extra-vars-ansible.yml'
- '-e @{{ playbook_dir }}/global_vars.yaml'
- name: rotate cephadm_command.log
become: true
shell: |
if [[ -e cephadm_command.log ]]; then
mv cephadm_command.log cephadm_command.log-$(date "+%Y-%m-%dT%H:%M:%S");
fi
args:
chdir: "{{ playbook_dir }}/cephadm/"
- name: save cephadm playbook command to shell script
copy:
dest: "{{ playbook_dir }}/cephadm/cephadm_command.sh"