Merge "Add dashboard for TC058"
[yardstick.git] / ansible / install_trex_standalone.yml
1 # Copyright (c) 2017 Intel Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 ---
15 - hosts: yardstick
16   vars:
17     ansible_python_interpreter: "/usr/bin/env python"
18     # needed for virtualenv
19     NSB_INSTALL_DIR: /root/nsb_install
20     INSTALL_BIN_PATH: /opt/nsb_bin
21     #TREX_DOWNLOAD: "https://trex-tgn.cisco.com/trex/release/v2.05.tar.gz"
22     TREX_VERSION: v2.20
23     TREX_DOWNLOAD: "https://trex-tgn.cisco.com/trex/release/{{ TREX_VERSION }}.tar.gz"
24
25   tasks:
26     - get_url:
27         url: "{{ TREX_DOWNLOAD }}"
28         dest: "{{ NSB_INSTALL_DIR }}"
29         checksum: "sha256:b9620341e552d2ef71d5ffa39ef92f12a1186836c250390db77bd7228497b91c"
30
31     - unarchive:
32         src: "{{ NSB_INSTALL_DIR }}/{{ TREX_DOWNLOAD|basename }}"
33         dest: "{{ NSB_INSTALL_DIR }}"
34         copy: no
35
36     - file: path="{{ INSTALL_BIN_PATH }}/trex" state=absent
37     - file: path="{{ INSTALL_BIN_PATH }}/trex" state=directory
38
39     - command: mv "{{ NSB_INSTALL_DIR }}/{{ TREX_DOWNLOAD|basename|regex_replace('\.tar.gz', '') }}" "{{ INSTALL_BIN_PATH }}/trex/scripts"
40
41     - file: path="{{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane/stl/__init__.py" state=touch
42
43     - command: cp "{{ INSTALL_BIN_PATH }}/trex/scripts/dpdk_nic_bind.py" "{{ INSTALL_BIN_PATH }}"
44
45     - name: add scripts to PYTHONPATH
46       lineinfile:
47         dest: /etc/environment
48         regexp: "^PYTHONPATH="
49         line: "PYTHONPATH={{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane:{{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane/stl:{{ NSB_INSTALL_DIR }}/yardstick"
50         state: present
51         create: yes