Add apache logs to the list of things we stage.
Change-Id: I9d3d8e710ae87a71b74f96538cad6fad58dbef79
| ... | ... |
@@ -19,6 +19,7 @@ |
| 19 | 19 |
when: tempest_log.stat.exists |
| 20 | 20 |
roles: |
| 21 | 21 |
- export-devstack-journal |
| 22 |
+ - apache-logs-conf |
|
| 22 | 23 |
- role: stage-output |
| 23 | 24 |
zuul_copy_output: |
| 24 | 25 |
{ '{{ devstack_conf_dir }}/local.conf': 'logs',
|
| ... | ... |
@@ -28,7 +29,9 @@ |
| 28 | 28 |
'{{ devstack_log_dir }}/devstacklog.txt': 'logs',
|
| 29 | 29 |
'{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs',
|
| 30 | 30 |
'{{ devstack_full_log}}': 'logs',
|
| 31 |
- '{{ stage_dir }}/verify_tempest_conf.log': 'logs' }
|
|
| 31 |
+ '{{ stage_dir }}/verify_tempest_conf.log': 'logs',
|
|
| 32 |
+ '{{ stage_dir }}/apache': 'logs',
|
|
| 33 |
+ '{{ stage_dir }}/apache_config': 'logs' }
|
|
| 32 | 34 |
extensions_to_txt: |
| 33 | 35 |
- conf |
| 34 | 36 |
- log |
| 0 | 2 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,80 @@ |
| 0 |
+- name: Ensure {{ stage_dir }}/apache exists
|
|
| 1 |
+ file: |
|
| 2 |
+ path: "{{ stage_dir }}/apache"
|
|
| 3 |
+ state: directory |
|
| 4 |
+ |
|
| 5 |
+- name: Link apache logs on Debian/SuSE |
|
| 6 |
+ block: |
|
| 7 |
+ - name: Find logs |
|
| 8 |
+ find: |
|
| 9 |
+ path: "/var/log/apache2" |
|
| 10 |
+ file_type: any |
|
| 11 |
+ register: debian_suse_apache_logs |
|
| 12 |
+ - name: Dereference files |
|
| 13 |
+ stat: |
|
| 14 |
+ path: "{{ item.path }}"
|
|
| 15 |
+ with_items: "{{ debian_suse_apache_logs.files }}"
|
|
| 16 |
+ register: debian_suse_apache_deref_logs |
|
| 17 |
+ - name: Create hard links |
|
| 18 |
+ file: |
|
| 19 |
+ src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
|
| 20 |
+ dest: "{{ stage_dir }}/apache/{{ item.stat.path | basename }}"
|
|
| 21 |
+ state: hard |
|
| 22 |
+ with_items: "{{ debian_suse_apache_deref_logs.results }}"
|
|
| 23 |
+ when: |
|
| 24 |
+ - item.stat.isreg or item.stat.islnk |
|
| 25 |
+ when: ansible_os_family in ('Debian', 'Suse')
|
|
| 26 |
+ |
|
| 27 |
+- name: Link apache logs on RedHat |
|
| 28 |
+ block: |
|
| 29 |
+ - name: Find logs |
|
| 30 |
+ find: |
|
| 31 |
+ path: "/var/log/httpd" |
|
| 32 |
+ file_type: any |
|
| 33 |
+ register: redhat_apache_logs |
|
| 34 |
+ - name: Dereference files |
|
| 35 |
+ stat: |
|
| 36 |
+ path: "{{ item.path }}"
|
|
| 37 |
+ with_items: "{{ redhat_apache_logs.files }}"
|
|
| 38 |
+ register: redhat_apache_deref_logs |
|
| 39 |
+ - name: Create hard links |
|
| 40 |
+ file: |
|
| 41 |
+ src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
|
| 42 |
+ dest: "{{ stage_dir }}/apache/{{ item.stat.path | basename }}"
|
|
| 43 |
+ state: hard |
|
| 44 |
+ with_items: "{{ redhat_apache_deref_logs.results }}"
|
|
| 45 |
+ when: |
|
| 46 |
+ - item.stat.isreg or item.stat.islnk |
|
| 47 |
+ when: ansible_os_family == 'Redhat' |
|
| 48 |
+ |
|
| 49 |
+- name: Ensure {{ stage_dir }}/apache_config apache_config exists
|
|
| 50 |
+ file: |
|
| 51 |
+ path: "{{ stage_dir }}/apache_config"
|
|
| 52 |
+ state: directory |
|
| 53 |
+ |
|
| 54 |
+- name: Define config paths |
|
| 55 |
+ set_fact: |
|
| 56 |
+ apache_config_paths: |
|
| 57 |
+ 'Debian': '/etc/apache2/sites-enabled/' |
|
| 58 |
+ 'Suse': '/etc/apache2/conf.d/' |
|
| 59 |
+ 'Redhat': '/etc/httpd/conf.d/' |
|
| 60 |
+ |
|
| 61 |
+- name: Discover configurations |
|
| 62 |
+ find: |
|
| 63 |
+ path: "{{ apache_config_paths[ansible_os_family] }}"
|
|
| 64 |
+ file_type: any |
|
| 65 |
+ register: apache_configs |
|
| 66 |
+ |
|
| 67 |
+- name: Dereference configurations |
|
| 68 |
+ stat: |
|
| 69 |
+ path: "{{ item.path }}"
|
|
| 70 |
+ with_items: "{{ apache_configs.files }}"
|
|
| 71 |
+ register: apache_configs_deref |
|
| 72 |
+ |
|
| 73 |
+- name: Link configurations |
|
| 74 |
+ file: |
|
| 75 |
+ src: "{{ item.stat.lnk_source | default(item.stat.path) }}"
|
|
| 76 |
+ dest: "{{ stage_dir }}/apache_config/{{ item.stat.path | basename }}"
|
|
| 77 |
+ state: hard |
|
| 78 |
+ with_items: "{{ apache_configs_deref.results }}"
|
|
| 79 |
+ when: item.stat.isreg or item.stat.islnk |