Merge "NSB: ignore VNF node if there is no VNF model"
[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 # 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 - my_make:
89     chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
90     extra_args: "-j {{ ansible_processor_vcpus }}"
91   environment:
92     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
93
94 #- name: make install DPDK into /usr for collectd and other programs
95 #  my_make:
96 #    chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}"
97 #    target: install
98 #    params: "T={{ RTE_TARGET }}"
99 ##    params: "prefix={{ usr_prefix }}"
100 #  environment:
101 #    RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
102 #  become: yes
103
104 - file:
105     path: "{{ dpdk_module_dir}}"
106     state: directory
107
108 - copy:
109     src: "{{ dpdk_path }}/{{ dpdk_make_arch }}/kmod/igb_uio.ko"
110     dest: "{{ dpdk_module_dir }}/igb_uio.ko"
111     remote_src: yes
112
113 - name: run depmod for dpdk_kernel
114   command: depmod "{{ dpdk_kernel }}"
115
116 - file:
117     path: "{{ INSTALL_BIN_PATH }}"
118     state:  directory
119
120 - name: copy dpdk-devbind.py to correct location
121   copy:
122     src: "{{ dpdk_devbind[dpdk_version] }}"
123     dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py"
124     remote_src: yes
125     force: yes
126     mode: 0755
127
128 - name: make dpdk_nic_bind.py for backwards compatibility
129   copy:
130     src: "{{ dpdk_devbind[dpdk_version] }}"
131     dest: "{{ INSTALL_BIN_PATH }}/dpdk_nic_bind.py"
132     remote_src: yes
133     force: yes
134     mode: 0755