add collectd ansible
[yardstick.git] / ansible / roles / install_dpdk_shared / 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: set DPDK shared dir
24   set_fact:
25     dpdk_shared_path: "{{ dpdk_path }}-shared"
26
27 - command: "cp -a {{ dpdk_path }} {{ dpdk_shared_path }}"
28
29 - name: find kernel for image, (including chroot)
30   find_kernel:
31     kernel: "{{ ansible_kernel }}"
32   register: found_kernel
33
34 # Do this before installing kernel headers
35 - name: Set dpdk_kernel to be the kernel we found
36   set_fact:
37     dpdk_kernel: "{{ found_kernel.kernel }}"
38
39 - include: "{{ ansible_os_family }}.yml"
40
41 - name: set RTE_KERNELDIR to point to found kernel
42   set_fact:
43     RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build"
44
45 - my_make:
46     chdir: "{{ dpdk_shared_path }}"
47     target: config
48     params:
49       T: "{{ dpdk_make_arch }}"
50       O: "{{ dpdk_make_arch }}"
51     extra_args: "-j {{ ansible_processor_vcpus }}"
52   environment:
53     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
54
55 - name: enable RTE_PORT_STATS_COLLECT
56   lineinfile:
57     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
58     regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n'
59     line: 'CONFIG_RTE_PORT_STATS_COLLECT=y'
60
61 - name: enable DPDK RTE_PORT_PCAP
62   lineinfile:
63     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
64     regexp: '^CONFIG_RTE_PORT_PCAP=n'
65     line: 'CONFIG_RTE_PORT_PCAP=y'
66
67 - name: enable DPDK RTE_TABLE_STATS_COLLECT
68   lineinfile:
69     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
70     regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n'
71     line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y'
72
73 - name: enable DPDK RTE_PIPELINE_STATS_COLLECT
74   lineinfile:
75     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
76     regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n'
77     line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y'
78
79 # This is requied for collectd but VNFs can't use shared DPDK
80 - name: enable CONFIG_RTE_BUILD_SHARED_LIB
81   lineinfile:
82     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
83     regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n'
84     line: 'CONFIG_RTE_BUILD_SHARED_LIB=y'
85
86 - name: enable DPDK CONFIG_RTE_EAL_PMD_PATH
87   lineinfile:
88     dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config"
89     regexp: '^CONFIG_RTE_EAL_PMD_PATH=""'
90     line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"'
91
92 - my_make:
93     chdir: "{{ dpdk_shared_path }}"
94     target: clean
95     params:
96     # no T= target for clean
97       O: "{{ dpdk_make_arch }}"
98     extra_args: "-j {{ ansible_processor_vcpus }}"
99   environment:
100     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
101
102 # TODO: disable ASLR
103
104 - my_make:
105     chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}"
106     extra_args: "-j {{ ansible_processor_vcpus }}"
107   environment:
108     RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
109
110 #- name: make install DPDK into /usr for collectd and other programs
111 #  my_make:
112 #    chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}"
113 #    target: install
114 #    params: "T={{ RTE_TARGET }}"
115 ##    params: "prefix={{ usr_prefix }}"
116 #  environment:
117 #    RTE_KERNELDIR: "{{ RTE_KERNELDIR }}"
118 #  become: yes
119
120 # don't install module or copy dpdk-devbind
121