ansible: update dpdk, trex and samplevnf install
[yardstick.git] / ansible / roles / install_dpdk / tasks / main.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 #- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=0
16 #  with_fileglob:
17 #    - "{{ local_nsb_path }}/patches/dpdk_custom_patch/rte_pipeline.patch"
18 #
19 #- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=1
20 #  with_fileglob:
21 #    - "{{ local_nsb_path }}/patches/dpdk_custom_patch/0*.patch"
22
23 - name: find kernel for image, (including chroot)
24   find_kernel:
25     kernel: "{{ ansible_kernel }}"
26   register: found_kernel
27
28 # Do this before installing kernel headers
29 - name: Set dpdk_kernel to be the kernel we found
30   set_fact:
31     dpdk_kernel: "{{ found_kernel.kernel }}"
32
33 - include: "{{ ansible_os_family }}.yml"
34
35 - name: set RTE_KERNELDIR to point to found kernel
36   set_fact:
37     RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build"
38
39 - my_make:
40     chdir: "{{ dpdk_path }}"
41     target: config
42     params:
43       T: "{{ dpdk_make_arch }}"
44       O: "{{ dpdk_make_arch }}"
45     extra_args: "-j {{ ansible_processor_vcpus }}"
46   environment:
47     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
48
49 - name: enable RTE_PORT_STATS_COLLECT
50   lineinfile:
51     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
52     regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n'
53     line: 'CONFIG_RTE_PORT_STATS_COLLECT=y'
54
55 - name: enable DPDK RTE_PORT_PCAP
56   lineinfile:
57     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
58     regexp: '^CONFIG_RTE_PORT_PCAP=n'
59     line: 'CONFIG_RTE_PORT_PCAP=y'
60
61 - name: enable DPDK RTE_TABLE_STATS_COLLECT
62   lineinfile:
63     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
64     regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n'
65     line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y'
66
67 - name: enable DPDK RTE_PIPELINE_STATS_COLLECT
68   lineinfile:
69     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
70     regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n'
71     line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y'
72
73 - my_make:
74     chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
75     extra_args: "-j {{ ansible_processor_vcpus }}"
76   environment:
77     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
78
79 - file:
80     path: "{{ dpdk_module_dir}}"
81     state: directory
82
83 - copy:
84     src: "{{ dpdk_path }}/{{ dpdk_make_arch }}/kmod/igb_uio.ko"
85     dest: "{{ dpdk_module_dir }}/igb_uio.ko"
86     remote_src: yes
87
88 - name: run depmod for dpdk_kernel
89   command: depmod "{{ dpdk_kernel }}"
90
91 - file:
92     path: "{{ INSTALL_BIN_PATH }}"
93     state:  directory
94
95 - name: copy dpdk-devbind.py to correct location
96   copy:
97     src: "{{ dpdk_devbind[dpdk_version] }}"
98     dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py"
99     remote_src: yes
100     force: yes
101     mode: 0755
102
103 - name: make dpdk_nic_bind.py for backwards compatibility
104   copy:
105     src: "{{ dpdk_devbind[dpdk_version] }}"
106     dest: "{{ INSTALL_BIN_PATH }}/dpdk_nic_bind.py"
107     remote_src: yes
108     force: yes
109     mode: 0755