Merge "NSB support for [core x-y] NSB PROX NFVI configuration"
[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 - debug:
24     var: dpdk_version
25     verbosity: 2
26
27 - name: find kernel for image, (including chroot)
28   find_kernel:
29     kernel: "{{ ansible_kernel }}"
30   register: found_kernel
31
32 # Do this before installing kernel headers
33 - name: Set dpdk_kernel to be the kernel we found
34   set_fact:
35     dpdk_kernel: "{{ found_kernel.kernel }}"
36
37 - include: "{{ ansible_os_family }}.yml"
38
39 - name: set RTE_KERNELDIR to point to found kernel
40   set_fact:
41     RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build"
42
43 - command: make -j {{ ansible_processor_vcpus }} config T={{ dpdk_make_arch }} O={{ dpdk_make_arch }}
44   args:
45     chdir: "{{ dpdk_path }}"
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 # This is requied for collectd? but it breaks PROX?
74 #- name: enable CONFIG_RTE_BUILD_SHARED_LIB
75 #  lineinfile:
76 #    dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
77 #    regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n'
78 #    line: 'CONFIG_RTE_BUILD_SHARED_LIB=y'
79 #
80 #- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH
81 #  lineinfile:
82 #    dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config"
83 #    regexp: '^CONFIG_RTE_EAL_PMD_PATH=""'
84 #    line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"'
85
86 # TODO: disable ASLR
87
88 - name: make dpdk
89   command: make -j {{ ansible_processor_vcpus }}
90   args:
91     chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
92   environment:
93     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
94
95 #- name: make install DPDK into /usr for collectd and other programs
96 #  make:
97 #    chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
98 #    target: install
99 #    params: "T={{ RTE_TARGET }}"
100 ##    params: "prefix={{ usr_prefix }}"
101 #  environment:
102 #    RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
103 #  become: yes
104
105 - file:
106     path: "{{ dpdk_module_dir}}"
107     state: directory
108
109 - copy:
110     src: "{{ dpdk_path }}/{{ dpdk_make_arch }}/kmod/igb_uio.ko"
111     dest: "{{ dpdk_module_dir }}/igb_uio.ko"
112     remote_src: yes
113   when: dpdk_version is version(dpdk_version_for_PROX, '>=')
114
115 - name: run depmod for dpdk_kernel
116   command: depmod "{{ dpdk_kernel }}"
117
118 - file:
119     path: "{{ INSTALL_BIN_PATH }}"
120     state:  directory
121
122 - name: copy dpdk-devbind.py to correct location
123   copy:
124     src: "{{ dpdk_devbind_usertools if dpdk_version is version('17.02', '>=') else dpdk_devbind_tools }}"
125     dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py"
126     remote_src: yes
127     force: yes
128     mode: 0755
129   when: dpdk_version is version(dpdk_version_for_PROX, '>=')
130
131 - name: make vPE binary
132   command: make -j {{ ansible_processor_vcpus }}
133   args:
134     chdir: "{{ dpdk_path }}/examples/ip_pipeline"
135   environment:
136     RTE_SDK: "{{ dpdk_path }}"
137   when: dpdk_version is version(dpdk_version_for_PROX, '!=')
138
139 - name: Copy vPE to correct location
140   copy:
141     src: "{{ dpdk_path }}/examples/ip_pipeline/build/app/ip_pipeline"
142     dest: "{{ INSTALL_BIN_PATH }}/vPE_vnf"
143     remote_src: yes
144     force: yes
145     mode: 0755
146   when: dpdk_version is version(dpdk_version_for_PROX, '!=')