diff options
author | 2017-04-21 03:45:45 +0000 | |
---|---|---|
committer | 2017-04-21 03:45:45 +0000 | |
commit | 441dea324dc2442b746528e0337a539c18b85b2f (patch) | |
tree | bcd4d5f1c7982b18cda123246007fa9314a10bd2 /resources/roles | |
parent | 1227dc7e737e9946f316c7693232a9f5cbe166ed (diff) | |
parent | a6d8313b300453c15e7c2438979db6253b6e6819 (diff) |
Merge "Fix workspace creator"
Diffstat (limited to 'resources/roles')
15 files changed, 117 insertions, 48 deletions
diff --git a/resources/roles/qtip-bootstrap/defaults/main.yml b/resources/roles/qtip-bootstrap/defaults/main.yml index 10e464e4..55e2cbce 100644 --- a/resources/roles/qtip-bootstrap/defaults/main.yml +++ b/resources/roles/qtip-bootstrap/defaults/main.yml @@ -8,7 +8,12 @@ ############################################################################## installer: fuel + installer_master: fuel-master -workspace: "./{{ installer }}-workspace" -qtip_package: ../.. +installer_master_group: + fuel: fuel-masters + apex: apex-underclouds + +workspace: "workspace" +qtip_package: ../../.. diff --git a/resources/roles/qtip-bootstrap/files/fixtures/case.json b/resources/roles/qtip-bootstrap/files/copy/fixtures/case.json index 22abc40f..22abc40f 100644 --- a/resources/roles/qtip-bootstrap/files/fixtures/case.json +++ b/resources/roles/qtip-bootstrap/files/copy/fixtures/case.json diff --git a/resources/roles/qtip-bootstrap/files/fixtures/pod.json b/resources/roles/qtip-bootstrap/files/copy/fixtures/pod.json index 654b5828..654b5828 100644 --- a/resources/roles/qtip-bootstrap/files/fixtures/pod.json +++ b/resources/roles/qtip-bootstrap/files/copy/fixtures/pod.json diff --git a/resources/roles/qtip-bootstrap/files/fixtures/project.json b/resources/roles/qtip-bootstrap/files/copy/fixtures/project.json index ecd03e83..ecd03e83 100644 --- a/resources/roles/qtip-bootstrap/files/fixtures/project.json +++ b/resources/roles/qtip-bootstrap/files/copy/fixtures/project.json diff --git a/resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep b/resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/copy/group_vars/.gitkeep diff --git a/resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep b/resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/copy/host_vars/.gitkeep diff --git a/resources/roles/qtip-bootstrap/files/run.yml b/resources/roles/qtip-bootstrap/files/copy/run.yml index 696235c2..52a66990 100644 --- a/resources/roles/qtip-bootstrap/files/run.yml +++ b/resources/roles/qtip-bootstrap/files/copy/run.yml @@ -12,42 +12,54 @@ # - system information # - test condition # - performance metrics + - hosts: compute - tasks: + + pre_tasks: - name: check ssh connection ping: - tags: [setup] -- hosts: compute roles: - - development-tools + - development-tools + + post_tasks: + - name: create dumping directories + file: + path: "{{ qtip_dump }}/{{ inventory_hostname }}" + state: directory + delegate_to: localhost + tags: [setup] + - hosts: compute + roles: - - unixbench - tags: [unixbench] -- hosts: compute + - { role: unixbench, tags: [unixbench] } + tasks: + - name: collect system information include: "{{ qtip_resources }}/metric/inxi.yaml" + - name: ssl metrics include: "{{ qtip_resources }}/metric/openssl.yaml" tags: [ssl] + - name: DPI metrics include: "{{ qtip_resources }}/metric/nDPI.yaml" vars: nDPI_cwd: "{{ ansible_env.HOME }}/qtip/nDPI" nDPI_file: "dpi.pcap" tags: [dpi] + - name: memory metrics include: "{{ qtip_resources }}/metric/ramspeed.yaml" vars: cwd: "{{ ansible_env.HOME }}/qtip/ramspeed" tags: [mem] -- hosts: compute - tasks: + - name: calculate QPI of compute calculate: metrics: @@ -57,35 +69,40 @@ delegate_to: localhost tags: [calculate] + - hosts: localhost + tasks: + - name: aggregate QPI results from all tested nodes aggregate: group: compute register: pod_result -# Generate and publish report + # Generate and publish report -- hosts: localhost - tasks: - name: create report folder file: path: "{{ qtip_reports }}" state: directory + - name: create system information report template: src: "{{ qtip_resources }}/template/system-info.j2" dest: "{{ qtip_reports }}/system-info" + - name: create qpi report template: src: "{{ qtip_resources }}/template/qpi-report.j2" dest: "{{ qtip_reports }}/qpi-report" tags: [report] + - name: create dpi metrics report template: src: "{{ qtip_resources }}/template/dpi-metrics.j2" dest: "{{ qtip_reports }}/dpi-metrics" tags: [report, dpi] + - name: push result to testapi uri: url: "{{ testapi_url }}/results" diff --git a/resources/roles/qtip-bootstrap/files/setup.yml b/resources/roles/qtip-bootstrap/files/copy/setup.yml index fed5e9d9..88cdb1d2 100644 --- a/resources/roles/qtip-bootstrap/files/setup.yml +++ b/resources/roles/qtip-bootstrap/files/copy/setup.yml @@ -8,19 +8,13 @@ ############################################################################## # Prepare connection to SUT (System Under Test) -- hosts: fuel-master +- hosts: fuel-masters gather_facts: no tasks: - name: collect facts of fuel hosts fuel: - - name: update inventory file - template: src={{ qtip_resources }}/template/hosts.j2 dest=./hosts - delegate_to: localhost - - name: update ssh.cfg file - template: src={{ qtip_resources }}/template/ssh.cfg.j2 dest=./ssh.cfg - delegate_to: localhost -- hosts: apex-undercloud +- hosts: apex-underclouds gather_facts: no tasks: @@ -34,13 +28,28 @@ apex_generate_inventory: baremetal_info: "{{ baremetal_info.stdout | from_json }}" server_info: "{{ server_info.stdout | from_json }}" + +- hosts: + - fuel-masters + - apex-underclouds + tasks: - name: update inventory file - template: src={{ qtip_resources }}/template/hosts.j2 dest=./hosts + template: src=templates/hosts dest=./hosts delegate_to: localhost - name: update ssh.cfg file - template: src={{ qtip_resources }}/template/ssh.cfg.j2 dest=./ssh.cfg + template: src=templates/ssh.cfg dest=./ssh.cfg delegate_to: localhost +- hosts: localhost + tasks: + - name: create output directories + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ qtip_cache }}" + - "{{ qtip_reports }}" + # Initialize testapi database - hosts: localhost tasks: diff --git a/resources/roles/qtip-bootstrap/files/copy/templates/hosts b/resources/roles/qtip-bootstrap/files/copy/templates/hosts new file mode 100644 index 00000000..27c8d1d6 --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/copy/templates/hosts @@ -0,0 +1,20 @@ +localhost ansible_connection=local + +[{{ installer_master_group[installer] }}] +{{ installer_master }} + +[fuel-groups:children] +{% for group in hosts|sort %} +{{ group }} +{% endfor %} + +[fuel-groups:vars] +ansible_ssh_common_args=-F ./ssh.cfg + +{% for group in hosts|sort %} +[{{ group }}] +{% for host in hosts[group]|sort %} +{{ host }} +{% endfor %} + +{% endfor %} diff --git a/resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg b/resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg new file mode 100644 index 00000000..d6a266ba --- /dev/null +++ b/resources/roles/qtip-bootstrap/files/copy/templates/ssh.cfg @@ -0,0 +1,14 @@ +# Connect to target node through jump host +# +# OpenSSH 7.3: +# ProxyJump jumphost +# before OpenSSH 7.3 +# ProxyCommand ssh -o 'ForwardAgent yes' jumphost 'ssh-add && nc %h %p' + +{% for (name, host) in hosts_meta.items() %} +Host {{ name }} + HostName {{ host.ansible_ssh_host }} + User root + ProxyCommand ssh -o 'ForwardAgent yes' {{ installer_master }} 'ssh-add && nc %h %p' + +{% endfor %} diff --git a/resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 b/resources/roles/qtip-bootstrap/files/render/ansible.cfg index 1d563f1a..2d4b0b1d 100644 --- a/resources/roles/qtip-bootstrap/templates/ansible.cfg.j2 +++ b/resources/roles/qtip-bootstrap/files/render/ansible.cfg @@ -56,6 +56,7 @@ gathering = smart # additional paths to search for roles in, colon separated #roles_path = /etc/ansible/roles +roles_path = {{ qtip_package }}/resources/roles # uncomment this to disable SSH key host checking #host_key_checking = False @@ -172,7 +173,7 @@ callback_whitelist = profile_tasks # set plugin path directories here, separate with colons -action_plugins = {{ qtip_package }}/ansible_library/plugins/action +action_plugins = {{ qtip_package }}/qtip/ansible_library/plugins/action #cache_plugins = /usr/share/ansible/plugins/cache #callback_plugins = /usr/share/ansible/plugins/callback #connection_plugins = /usr/share/ansible/plugins/connection @@ -329,7 +330,6 @@ filter_plugins = {{ qtip_package }}/qtip/ansible_library/plugins/filter # Leaving off ControlPersist will result in poor performance, so use # paramiko on older platforms rather than removing it, -C controls compression use #ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -ssh_args = -F ssh.cfg # The base directory for the ControlPath sockets. # This is the "%(directory)s" in the control_path option diff --git a/resources/roles/qtip-bootstrap/files/group_vars/all.yml b/resources/roles/qtip-bootstrap/files/render/group_vars/all.yml index 933cffe5..c00e72a4 100644 --- a/resources/roles/qtip-bootstrap/files/group_vars/all.yml +++ b/resources/roles/qtip-bootstrap/files/render/group_vars/all.yml @@ -7,7 +7,21 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -qtip_resources: ../../resources -qtip_reports: ./reports -qtip_fixtures: ./fixtures -qtip_dump: ./dump +qtip_resources: "{{ qtip_package }}/resources" +qtip_reports: reports +qtip_fixtures: fixtures +qtip_dump: dump +qtip_cache: .cache + +testapi_url: http://localhost:8000/api/v1 +project_name: qtip +case_name: compute +pod_name: qtip-pod +installer: "{{ installer }}" +version: master +scenario: demo + +installer_master: "{{ installer_master }}" +installer_master_group: + fuel: fuel-masters + apex: apex-underclouds diff --git a/resources/roles/qtip-bootstrap/files/host_vars/localhost.yml b/resources/roles/qtip-bootstrap/files/render/host_vars/localhost.yml index 66aa5d0e..8135e809 100644 --- a/resources/roles/qtip-bootstrap/files/host_vars/localhost.yml +++ b/resources/roles/qtip-bootstrap/files/render/host_vars/localhost.yml @@ -7,10 +7,3 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -testapi_url: http://localhost:8000/api/v1 -project_name: qtip -case_name: compute -pod_name: qtip-pod -installer: fuel -version: master -scenario: demo diff --git a/resources/roles/qtip-bootstrap/templates/hosts.j2 b/resources/roles/qtip-bootstrap/files/render/hosts index c4b985b3..bf19efab 100644 --- a/resources/roles/qtip-bootstrap/templates/hosts.j2 +++ b/resources/roles/qtip-bootstrap/files/render/hosts @@ -1,3 +1,4 @@ localhost ansible_connection=local +[{{ installer_master_group[installer] }}] {{ installer_master }} diff --git a/resources/roles/qtip-bootstrap/tasks/main.yml b/resources/roles/qtip-bootstrap/tasks/main.yml index 96d6c7d8..e198732b 100644 --- a/resources/roles/qtip-bootstrap/tasks/main.yml +++ b/resources/roles/qtip-bootstrap/tasks/main.yml @@ -9,17 +9,13 @@ - name: copy initial files synchronize: - src: "{{ item }}" - dest: "{{ workspace }}" - with_items: - - group_vars - - host_vars - - fixtures + src: copy/ + dest: "{{ workspace }}/" - name: generate default configuration template: - src: "{{ item }}.j2" - dest: "{{ workspace }}/{{ item }}" - with_items: - - ansible.cfg - - hosts + src: "{{ item.src }}" + dest: "{{ workspace }}/{{ item.path }}" + force: yes + with_filetree: render + when: item.state == 'file' |