Merge "Zuul v3: add start-fresh logging role"

This commit is contained in:
Jenkins 2017-08-25 18:01:30 +00:00 committed by Gerrit Code Review
commit b2b61ee28b
4 changed files with 69 additions and 0 deletions

View File

@ -2,4 +2,5 @@
roles:
- setup-devstack-source-dirs
- setup-devstack-log-dir
- start-fresh-logging
- write-devstack-local-conf

View File

@ -0,0 +1,11 @@
Restart logging on all hosts
Restart syslog so that the system logs only include output from the
job.
**Role Variables**
.. zuul:rolevar:: devstack_base_dir
:default: /opt/stack
The devstack base directory.

View File

@ -0,0 +1 @@
devstack_base_dir: /opt/stack

View File

@ -0,0 +1,56 @@
- name: Check for /bin/journalctl file
command: which journalctl
changed_when: False
failed_when: False
register: which_out
- block:
- name: Get current date
command: date +"%Y-%m-%d %H:%M:%S"
register: date_out
- name: Copy current date to log-start-timestamp.txt
copy:
dest: "{{ devstack_base_dir }}/log-start-timestamp.txt"
content: "{{ date_out.stdout }}"
when: which_out.rc == 0
become: yes
- block:
- name: Stop rsyslog
service: name=rsyslog state=stopped
- name: Save syslog file prior to devstack run
command: mv /var/log/syslog /var/log/syslog-pre-devstack
- name: Save kern.log file prior to devstack run
command: mv /var/log/kern.log /var/log/kern_log-pre-devstack
- name: Recreate syslog file
file: name=/var/log/syslog state=touch
- name: Recreate syslog file owner and group
command: chown /var/log/syslog --ref /var/log/syslog-pre-devstack
- name: Recreate syslog file permissions
command: chmod /var/log/syslog --ref /var/log/syslog-pre-devstack
- name: Add read permissions to all on syslog file
file: name=/var/log/syslog mode=a+r
- name: Recreate kern.log file
file: name=/var/log/kern.log state=touch
- name: Recreate kern.log file owner and group
command: chown /var/log/kern.log --ref /var/log/kern_log-pre-devstack
- name: Recreate kern.log file permissions
command: chmod /var/log/kern.log --ref /var/log/kern_log-pre-devstack
- name: Add read permissions to all on kern.log file
file: name=/var/log/kern.log mode=a+r
- name: Start rsyslog
service: name=rsyslog state=started
when: which_out.rc == 1
become: yes