From d158e53addc56a9f92ecf0947eda4110c23da8ee Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Tue, 25 Apr 2017 16:46:51 +0800 Subject: Organize common tasks under qtip-common role Change-Id: I8592efdac7e6c2161eb7cb1b36d023697ebe7ad4 Signed-off-by: Yujun Zhang --- resources/ansible_roles/inxi/meta/main.yml | 14 ++++++++++++++ resources/ansible_roles/inxi/tasks/main.yml | 10 ++-------- resources/ansible_roles/nDPI/meta/main.yml | 14 ++++++++++++++ resources/ansible_roles/nDPI/tasks/main.yml | 8 ++------ resources/ansible_roles/openssl/meta/main.yml | 14 ++++++++++++++ resources/ansible_roles/openssl/tasks/main.yml | 10 +++++----- resources/ansible_roles/qtip-common/tasks/main.yml | 21 +++++++++++++++++++++ .../qtip-workspace/files/defaults/run.yml | 10 +++++----- resources/ansible_roles/qtip/tasks/calculate.yml | 2 +- resources/ansible_roles/ramspeed/meta/main.yml | 14 ++++++++++++++ resources/ansible_roles/ramspeed/tasks/main.yml | 10 +++++----- resources/ansible_roles/unixbench/meta/main.yml | 14 ++++++++++++++ resources/ansible_roles/unixbench/tasks/main.yml | 14 ++------------ 13 files changed, 113 insertions(+), 42 deletions(-) create mode 100644 resources/ansible_roles/inxi/meta/main.yml create mode 100644 resources/ansible_roles/nDPI/meta/main.yml create mode 100644 resources/ansible_roles/openssl/meta/main.yml create mode 100644 resources/ansible_roles/qtip-common/tasks/main.yml create mode 100644 resources/ansible_roles/ramspeed/meta/main.yml create mode 100644 resources/ansible_roles/unixbench/meta/main.yml diff --git a/resources/ansible_roles/inxi/meta/main.yml b/resources/ansible_roles/inxi/meta/main.yml new file mode 100644 index 00000000..76f78a32 --- /dev/null +++ b/resources/ansible_roles/inxi/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: inxi } diff --git a/resources/ansible_roles/inxi/tasks/main.yml b/resources/ansible_roles/inxi/tasks/main.yml index e7ffd18c..d9dbf7ad 100644 --- a/resources/ansible_roles/inxi/tasks/main.yml +++ b/resources/ansible_roles/inxi/tasks/main.yml @@ -16,12 +16,6 @@ command: inxi -b -c0 -n register: inxi_out -- name: generating log filename - set_fact: - logfile: "{{ qtip_results }}/inxi.log" - tags: - - always - - name: saving output to log copy: content: "{{ inxi_out.stdout }}" @@ -52,7 +46,7 @@ - '.+\sKernel:\s+(?P.+)\sConsole' - '.+\s+HDD Total Size:\s+(?P.+)\s' - '.+\sproduct:\s+(?P.+)\sv' - export_to: "{{ qtip_results }}/system_info.json" + dest: "{{ output }}/condition.json" register: system_info delegate_to: localhost tags: @@ -61,7 +55,7 @@ - name: create system information report template: src: system-info.j2 - dest: "{{ qtip_results }}/system-info" + dest: "{{ output }}/report" delegate_to: localhost tags: - report diff --git a/resources/ansible_roles/nDPI/meta/main.yml b/resources/ansible_roles/nDPI/meta/main.yml new file mode 100644 index 00000000..b035a9a9 --- /dev/null +++ b/resources/ansible_roles/nDPI/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: nDPI } diff --git a/resources/ansible_roles/nDPI/tasks/main.yml b/resources/ansible_roles/nDPI/tasks/main.yml index c007a613..6dc7bf9d 100644 --- a/resources/ansible_roles/nDPI/tasks/main.yml +++ b/resources/ansible_roles/nDPI/tasks/main.yml @@ -49,10 +49,6 @@ chdir: "{{ workdir }}/nDPI-1.6/example/" register: ndpi_out -- name: generating log filename - set_fact: - logfile: "{{ qtip_results }}/nDPI.log" - - name: saving output to log copy: content: "{{ ndpi_out.stdout }}" @@ -66,12 +62,12 @@ # nDPI throughput: 1.46 M pps / 13.69 Gb/sec # TODO(yujunz) convert "M pps" and "K pps" to number - 'nDPI throughput:\s+?(?P\d+.\d+.*) \/ (?P\d+.\d+.*)$' - export_to: "{{ qtip_results }}/dpi_metrics.json" + dest: "{{ output }}/metrics.json" register: dpi_metrics delegate_to: localhost - name: create dpi report template: src: dpi-metrics.j2 - dest: "{{ qtip_results }}/dpi-metrics" + dest: "{{ output }}/dpi-metrics" delegate_to: localhost diff --git a/resources/ansible_roles/openssl/meta/main.yml b/resources/ansible_roles/openssl/meta/main.yml new file mode 100644 index 00000000..d7c4381a --- /dev/null +++ b/resources/ansible_roles/openssl/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: openssl } diff --git a/resources/ansible_roles/openssl/tasks/main.yml b/resources/ansible_roles/openssl/tasks/main.yml index 91c5be93..0d57ef2d 100644 --- a/resources/ansible_roles/openssl/tasks/main.yml +++ b/resources/ansible_roles/openssl/tasks/main.yml @@ -23,8 +23,8 @@ - name: generating log filename set_fact: - rsa_logfile: "{{ qtip_results }}/openssl_rsa.log" - aes_logfile: "{{ qtip_results }}/openssl_aes.log" + rsa_logfile: "{{ output }}/openssl-rsa.log" + aes_logfile: "{{ output }}/openssl-aes.log" tags: always # TODO(yujunz) `delegate_to` not working under `with_items` @@ -60,7 +60,7 @@ ^rsa\s+4096\sbits\s.+\s+ ?(?P\d+\.\d)\s+ ?(?P\d+\.\d)$ - export_to: "{{ qtip_results }}/ssl_rsa_metrics.json" + dest: "{{ output }}/rsa-metrics.json" register: ssl_rsa_metrics tags: collect @@ -75,13 +75,13 @@ ?(?P\d+\.\w+)\s+ ?(?P\d+\.\w+)\s+ ?(?P\d+\.\w+)$ - export_to: "{{ qtip_results }}/ssl_aes_metrics.json" + dest: "{{ output }}/aes-metrics.json" register: ssl_aes_metrics tags: collect - name: create SSL report template: src: ssl-metrics.j2 - dest: "{{ qtip_results }}/ssl-metrics" + dest: "{{ output }}/ssl-metrics" delegate_to: localhost tags: report diff --git a/resources/ansible_roles/qtip-common/tasks/main.yml b/resources/ansible_roles/qtip-common/tasks/main.yml new file mode 100644 index 00000000..72fae2bb --- /dev/null +++ b/resources/ansible_roles/qtip-common/tasks/main.yml @@ -0,0 +1,21 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +- name: creating output directory + file: + state: directory + path: "{{ output }}" + delegate_to: localhost + +- name: generating log filename + set_fact: + logfile: "{{ output }}/{{ basename }}.log" + tags: always diff --git a/resources/ansible_roles/qtip-workspace/files/defaults/run.yml b/resources/ansible_roles/qtip-workspace/files/defaults/run.yml index 15b12214..41df913b 100644 --- a/resources/ansible_roles/qtip-workspace/files/defaults/run.yml +++ b/resources/ansible_roles/qtip-workspace/files/defaults/run.yml @@ -27,11 +27,11 @@ roles: # run test and collect metrics - - { role: inxi, tags: [run, inxi, sysinfo] } - - { role: unixbench, tags: [run, unixbench, arithmetic] } - - { role: openssl, tags: [run, openssl, ssl] } - - { role: nDPI, tags: [run, ndpi, dpi] } - - { role: ramspeed, tags: [run, ramspeed, memory] } + - { role: inxi, output: "{{ qtip_results }}/sysinfo", tags: [run, inxi, sysinfo] } + - { role: unixbench, output: "{{ qtip_results }}/arithmetic", tags: [run, unixbench, arithmetic] } + - { role: openssl, output: "{{ qtip_results }}/ssl", tags: [run, openssl, ssl] } + - { role: nDPI, output: "{{ qtip_results }}/dpi", tags: [run, ndpi, dpi] } + - { role: ramspeed, output: "{{ qtip_results }}/memory", tags: [run, ramspeed, memory] } # calculate scores - { role: qtip, tasks: calculate, tags: [calculate] } diff --git a/resources/ansible_roles/qtip/tasks/calculate.yml b/resources/ansible_roles/qtip/tasks/calculate.yml index 3bcda9f9..e0673645 100644 --- a/resources/ansible_roles/qtip/tasks/calculate.yml +++ b/resources/ansible_roles/qtip/tasks/calculate.yml @@ -15,6 +15,6 @@ ssl_rsa: "{{ ssl_rsa_metrics }}" ssl_aes: "{{ ssl_aes_metrics }}" spec: "{{ qtip_resources }}/QPI/compute.yaml" - export_to: "{{ qtip_results }}/qpi_result.json" + dest: "{{ qtip_results }}/qpi_result.json" register: qpi_result delegate_to: localhost diff --git a/resources/ansible_roles/ramspeed/meta/main.yml b/resources/ansible_roles/ramspeed/meta/main.yml new file mode 100644 index 00000000..9f6305c1 --- /dev/null +++ b/resources/ansible_roles/ramspeed/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: ramspeed } diff --git a/resources/ansible_roles/ramspeed/tasks/main.yml b/resources/ansible_roles/ramspeed/tasks/main.yml index affa1111..34b38fa1 100644 --- a/resources/ansible_roles/ramspeed/tasks/main.yml +++ b/resources/ansible_roles/ramspeed/tasks/main.yml @@ -45,8 +45,8 @@ - name: generating log filename set_fact: - int_logfile: "{{ qtip_results }}/ramsmp-int.log" - float_logfile: "{{ qtip_results }}/ramsmp-float.log" + int_logfile: "{{ output }}/ramsmp-int.log" + float_logfile: "{{ output }}/ramsmp-float.log" - name: saving integer output to log copy: @@ -69,7 +69,7 @@ - '^INTEGER\s+BatchRun\s+Add:\s+?(?P\d+\.\d+)\sMB/s$' - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P\d+\.\d+)\sMB/s$' - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P\d+\.\d+)\sMB/s$' - export_to: "{{ qtip_results }}/ram_int_metrics.json" + dest: "{{ output }}/integer-metrics.json" register: intmem_metrics - name: collect float memory metrics from ramspeed @@ -81,11 +81,11 @@ - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P\d+\.\d+)\sMB/s$' - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P\d+\.\d+)\sMB/s$' - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P\d+\.\d+)\sMB/s$' - export_to: "{{ qtip_results }}/ram_float_metrics.json" + dest: "{{ output }}/float-metrics.json" register: floatmem_metrics - name: create memory metrics report template: src: "memory-metrics.j2" - dest: "{{ qtip_results }}/memory-metrics" + dest: "{{ output }}/report" delegate_to: localhost diff --git a/resources/ansible_roles/unixbench/meta/main.yml b/resources/ansible_roles/unixbench/meta/main.yml new file mode 100644 index 00000000..333c512e --- /dev/null +++ b/resources/ansible_roles/unixbench/meta/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +--- + +allow_duplicates: yes +dependencies: +- { role: qtip-common, basename: unixbench } diff --git a/resources/ansible_roles/unixbench/tasks/main.yml b/resources/ansible_roles/unixbench/tasks/main.yml index e087bcb9..64e1021d 100644 --- a/resources/ansible_roles/unixbench/tasks/main.yml +++ b/resources/ansible_roles/unixbench/tasks/main.yml @@ -37,16 +37,6 @@ chdir: "{{ workdir }}/byte-unixbench-5.1.3/UnixBench" register: unixbench_out -- name: generating log filename - set_fact: - logfile: "{{ qtip_results }}/unixbench.log" - -- name: saving output to log - copy: - content: "{{ unixbench_out.stdout }}" - dest: "{{ logfile }}" - delegate_to: localhost - - name: saving unixbench output to log copy: content: "{{ unixbench_out.stdout }}" @@ -61,12 +51,12 @@ # Double-Precision Whetstone 55.0 3720.5 676.5 - '^Dhrystone 2 using register variables\s+(\d+\.\d+)\s+(?P\d+\.\d+)\s+(\d+\.\d+)' - '^Double-Precision Whetstone\s+(\d+\.\d+)\s+(?P\d+\.\d+)\s+(\d+\.\d+)' - export_to: "{{ qtip_results }}/arithmetic_metrics.json" + dest: "{{ output }}/metrics.json" register: arithmetic_metrics delegate_to: localhost - name: creating arithmetic metrics report template: src: arithmetic-metrics.j2 - dest: "{{ qtip_results }}/arithmetic-metrics" + dest: "{{ output }}/report" delegate_to: localhost -- cgit 1.2.3-korg