cleanup: rm node_ID from yardstick prepare_env file
[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 - command: make -j {{ ansible_processor_vcpus }} config T={{ dpdk_make_arch }} O={{ dpdk_make_arch }}
40   args:
41     chdir: "{{ dpdk_path }}"
42   environment:
43     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
44
45 - name: enable RTE_PORT_STATS_COLLECT
46   lineinfile:
47     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
48     regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n'
49     line: 'CONFIG_RTE_PORT_STATS_COLLECT=y'
50
51 - name: enable DPDK RTE_PORT_PCAP
52   lineinfile:
53     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
54     regexp: '^CONFIG_RTE_PORT_PCAP=n'
55     line: 'CONFIG_RTE_PORT_PCAP=y'
56
57 - name: enable DPDK RTE_TABLE_STATS_COLLECT
58   lineinfile:
59     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
60     regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n'
61     line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y'
62
63 - name: enable DPDK RTE_PIPELINE_STATS_COLLECT
64   lineinfile:
65     dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
66     regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n'
67     line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y'
68
69 # This is requied for collectd? but it breaks PROX?
70 #- name: enable CONFIG_RTE_BUILD_SHARED_LIB
71 #  lineinfile:
72 #    dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
73 #    regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n'
74 #    line: 'CONFIG_RTE_BUILD_SHARED_LIB=y'
75 #
76 #- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH
77 #  lineinfile:
78 #    dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
79 #    regexp: '^CONFIG_RTE_EAL_PMD_PATH=""'
80 #    line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"'
81
82 # TODO: disable ASLR
83
84 - name: make dpdk
85   command: make -j {{ ansible_processor_vcpus }}
86   args:
87     chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
88   environment:
89     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
90
91 #- name: make install DPDK into /usr for collectd and other programs
92 #  make:
93 #    chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
94 #    target: install
95 #    params: "T={{ RTE_TARGET }}"
96 ##    params: "prefix={{ usr_prefix }}"
97 #  environment:
98 #    RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
99 #  become: yes
100
101 - file:
102     path: "{{ dpdk_module_dir}}"
103     state: directory
104
105 - copy:
106     src: "{{ dpdk_path }}/{{ dpdk_make_arch }}/kmod/igb_uio.ko"
107     dest: "{{ dpdk_module_dir }}/igb_uio.ko"
108     remote_src: yes
109
110 - name: run depmod for dpdk_kernel
111   command: depmod "{{ dpdk_kernel }}"
112
113 - file:
114     path: "{{ INSTALL_BIN_PATH }}"
115     state:  directory
116
117 - name: copy dpdk-devbind.py to correct location
118   copy:
119     src: "{{ dpdk_devbind[dpdk_version] }}"
120     dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py"
121     remote_src: yes
122     force: yes
123     mode: 0755
124
125 - name: make dpdk_nic_bind.py for backwards compatibility
126   copy:
127     src: "{{ dpdk_devbind[dpdk_version] }}"
128     dest: "{{ INSTALL_BIN_PATH }}/dpdk_nic_bind.py"
129     remote_src: yes
130     force: yes
131     mode: 0755