Stage apache logs
Add apache logs to the list of things we stage. Change-Id: I9d3d8e710ae87a71b74f96538cad6fad58dbef79
This commit is contained in:
parent
b7f8624bed
commit
9c977b56eb
@ -19,6 +19,7 @@
|
|||||||
when: tempest_log.stat.exists
|
when: tempest_log.stat.exists
|
||||||
roles:
|
roles:
|
||||||
- export-devstack-journal
|
- export-devstack-journal
|
||||||
|
- apache-logs-conf
|
||||||
- role: stage-output
|
- role: stage-output
|
||||||
zuul_copy_output:
|
zuul_copy_output:
|
||||||
{ '{{ devstack_conf_dir }}/local.conf': 'logs',
|
{ '{{ devstack_conf_dir }}/local.conf': 'logs',
|
||||||
@ -28,7 +29,9 @@
|
|||||||
'{{ devstack_log_dir }}/devstacklog.txt': 'logs',
|
'{{ devstack_log_dir }}/devstacklog.txt': 'logs',
|
||||||
'{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs',
|
'{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs',
|
||||||
'{{ devstack_full_log}}': 'logs',
|
'{{ devstack_full_log}}': 'logs',
|
||||||
'{{ stage_dir }}/verify_tempest_conf.log': 'logs' }
|
'{{ stage_dir }}/verify_tempest_conf.log': 'logs',
|
||||||
|
'{{ stage_dir }}/apache': 'logs',
|
||||||
|
'{{ stage_dir }}/apache_config': 'logs' }
|
||||||
extensions_to_txt:
|
extensions_to_txt:
|
||||||
- conf
|
- conf
|
||||||
- log
|
- log
|
||||||
|
2
roles/apache-logs-conf/defaults/main.yaml
Normal file
2
roles/apache-logs-conf/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
devstack_base_dir: /opt/stack
|
||||||
|
stage_dir: "{{ ansible_user_dir }}"
|
80
roles/apache-logs-conf/tasks/main.yaml
Normal file
80
roles/apache-logs-conf/tasks/main.yaml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
- name: Ensure {{ stage_dir }}/apache exists
|
||||||
|
file:
|
||||||
|
path: "{{ stage_dir }}/apache"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Link apache logs on Debian/SuSE
|
||||||
|
block:
|
||||||
|
- name: Find logs
|
||||||
|
find:
|
||||||
|
path: "/var/log/apache2"
|
||||||
|
file_type: any
|
||||||
|
register: debian_suse_apache_logs
|
||||||
|
- name: Dereference files
|
||||||
|
stat:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
with_items: "{{ debian_suse_apache_logs.files }}"
|
||||||
|
register: debian_suse_apache_deref_logs
|
||||||
|
- name: Create hard links
|
||||||
|
file:
|
||||||
|
src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
||||||
|
dest: "{{ stage_dir }}/apache/{{ item.stat.path | basename }}"
|
||||||
|
state: hard
|
||||||
|
with_items: "{{ debian_suse_apache_deref_logs.results }}"
|
||||||
|
when:
|
||||||
|
- item.stat.isreg or item.stat.islnk
|
||||||
|
when: ansible_os_family in ('Debian', 'Suse')
|
||||||
|
|
||||||
|
- name: Link apache logs on RedHat
|
||||||
|
block:
|
||||||
|
- name: Find logs
|
||||||
|
find:
|
||||||
|
path: "/var/log/httpd"
|
||||||
|
file_type: any
|
||||||
|
register: redhat_apache_logs
|
||||||
|
- name: Dereference files
|
||||||
|
stat:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
with_items: "{{ redhat_apache_logs.files }}"
|
||||||
|
register: redhat_apache_deref_logs
|
||||||
|
- name: Create hard links
|
||||||
|
file:
|
||||||
|
src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
||||||
|
dest: "{{ stage_dir }}/apache/{{ item.stat.path | basename }}"
|
||||||
|
state: hard
|
||||||
|
with_items: "{{ redhat_apache_deref_logs.results }}"
|
||||||
|
when:
|
||||||
|
- item.stat.isreg or item.stat.islnk
|
||||||
|
when: ansible_os_family == 'Redhat'
|
||||||
|
|
||||||
|
- name: Ensure {{ stage_dir }}/apache_config apache_config exists
|
||||||
|
file:
|
||||||
|
path: "{{ stage_dir }}/apache_config"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Define config paths
|
||||||
|
set_fact:
|
||||||
|
apache_config_paths:
|
||||||
|
'Debian': '/etc/apache2/sites-enabled/'
|
||||||
|
'Suse': '/etc/apache2/conf.d/'
|
||||||
|
'Redhat': '/etc/httpd/conf.d/'
|
||||||
|
|
||||||
|
- name: Discover configurations
|
||||||
|
find:
|
||||||
|
path: "{{ apache_config_paths[ansible_os_family] }}"
|
||||||
|
file_type: any
|
||||||
|
register: apache_configs
|
||||||
|
|
||||||
|
- name: Dereference configurations
|
||||||
|
stat:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
with_items: "{{ apache_configs.files }}"
|
||||||
|
register: apache_configs_deref
|
||||||
|
|
||||||
|
- name: Link configurations
|
||||||
|
file:
|
||||||
|
src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
||||||
|
dest: "{{ stage_dir }}/apache_config/{{ item.stat.path | basename }}"
|
||||||
|
state: hard
|
||||||
|
with_items: "{{ apache_configs_deref.results }}"
|
||||||
|
when: item.stat.isreg or item.stat.islnk
|
Loading…
x
Reference in New Issue
Block a user