From 619acb7a3e0e2d33699a25cc0e5ffda78c4c4f8c Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Wed, 30 Aug 2017 00:52:07 -0700 Subject: add collectd ansible required DPDK fixes to enable building collectd with dpdkstats need /usr/lib/dpdk-pmd symlinks Compiling all this code requies more space than the default ubuntu cloud-image, so we need to resize the cloud image somehow Change-Id: Ib39fc94ba8101ca1aebc7d2a710be88b0338f7c3 Signed-off-by: Ross Brattain Signed-off-by: Maciej Skrocki --- ansible/filter_plugins/networks.py | 5 +- ansible/install_collectd.yml | 30 +++++ .../roles/add_heat_stack_owner_role/tasks/main.yml | 2 +- ansible/roles/download_collectd/defaults/main.yml | 4 + ansible/roles/download_collectd/tasks/main.yml | 29 +++++ .../roles/download_intel_cmt_cat/defaults/main.yml | 4 + .../roles/download_intel_cmt_cat/tasks/main.yml | 29 +++++ ansible/roles/download_yajl/defaults/main.yml | 4 + ansible/roles/download_yajl/tasks/main.yml | 29 +++++ .../enable_hugepages_on_boot/defaults/main.yml | 9 +- .../roles/enable_hugepages_on_boot/tasks/main.yml | 5 + ansible/roles/install_collectd/tasks/main.yml | 38 +++++++ ansible/roles/install_collectd/vars/main.yml | 38 +++++++ ansible/roles/install_dpdk/tasks/main.yml | 25 +++++ ansible/roles/install_dpdk/vars/main.yml | 1 + .../roles/install_dpdk_shared/defaults/main.yml | 2 + ansible/roles/install_dpdk_shared/tasks/Debian.yml | 22 ++++ ansible/roles/install_dpdk_shared/tasks/RedHat.yml | 29 +++++ ansible/roles/install_dpdk_shared/tasks/main.yml | 121 +++++++++++++++++++++ ansible/roles/install_dpdk_shared/vars/main.yml | 9 ++ ansible/roles/install_intel_cmt_cat/tasks/main.yml | 25 +++++ ansible/roles/install_intel_cmt_cat/vars/main.yml | 38 +++++++ ansible/roles/install_rabbitmq/tasks/main.yml | 22 ++++ .../install_rabbitmq/templates/RedHat-repos.j2 | 21 ++++ ansible/roles/install_rabbitmq/vars/main.yml | 22 ++++ ansible/roles/install_samplevnf/tasks/main.yml | 9 +- ansible/roles/install_samplevnf/vars/main.yml | 17 +++ ansible/roles/install_yajl/tasks/main.yml | 33 ++++++ ansible/roles/install_yajl/vars/main.yml | 38 +++++++ ansible/roles/package_clean/tasks/Debian.yml | 16 +++ ansible/roles/package_clean/tasks/RedHat.yml | 17 +++ ansible/roles/package_clean/tasks/main.yml | 15 +++ .../ubuntu_server_baremetal_deploy_samplevnfs.yml | 9 ++ .../ubuntu_server_cloudimg_modify_samplevnfs.yml | 10 +- 34 files changed, 721 insertions(+), 6 deletions(-) create mode 100644 ansible/install_collectd.yml create mode 100644 ansible/roles/download_collectd/defaults/main.yml create mode 100644 ansible/roles/download_collectd/tasks/main.yml create mode 100644 ansible/roles/download_intel_cmt_cat/defaults/main.yml create mode 100644 ansible/roles/download_intel_cmt_cat/tasks/main.yml create mode 100644 ansible/roles/download_yajl/defaults/main.yml create mode 100644 ansible/roles/download_yajl/tasks/main.yml create mode 100644 ansible/roles/install_collectd/tasks/main.yml create mode 100644 ansible/roles/install_collectd/vars/main.yml create mode 100644 ansible/roles/install_dpdk_shared/defaults/main.yml create mode 100755 ansible/roles/install_dpdk_shared/tasks/Debian.yml create mode 100644 ansible/roles/install_dpdk_shared/tasks/RedHat.yml create mode 100644 ansible/roles/install_dpdk_shared/tasks/main.yml create mode 100644 ansible/roles/install_dpdk_shared/vars/main.yml create mode 100644 ansible/roles/install_intel_cmt_cat/tasks/main.yml create mode 100644 ansible/roles/install_intel_cmt_cat/vars/main.yml create mode 100644 ansible/roles/install_rabbitmq/tasks/main.yml create mode 100644 ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 create mode 100644 ansible/roles/install_rabbitmq/vars/main.yml create mode 100644 ansible/roles/install_yajl/tasks/main.yml create mode 100644 ansible/roles/install_yajl/vars/main.yml create mode 100755 ansible/roles/package_clean/tasks/Debian.yml create mode 100644 ansible/roles/package_clean/tasks/RedHat.yml create mode 100644 ansible/roles/package_clean/tasks/main.yml diff --git a/ansible/filter_plugins/networks.py b/ansible/filter_plugins/networks.py index a1573951f..d67615a53 100644 --- a/ansible/filter_plugins/networks.py +++ b/ansible/filter_plugins/networks.py @@ -13,7 +13,10 @@ # limitations under the License. -from urlparse import urlsplit +try: + from urlparse import urlsplit +except ImportError: + from urllib.parse import urlsplit def do_prefix_to_netmask(arg): diff --git a/ansible/install_collectd.yml b/ansible/install_collectd.yml new file mode 100644 index 000000000..26d18799c --- /dev/null +++ b/ansible/install_collectd.yml @@ -0,0 +1,30 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- hosts: all + vars: + clone_dir: /tmp/yardstick-clone + + roles: + # build shared DPDK for collectd only, required DPDK downloaded already + - role: download_dpdk + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_yajl + - install_yajl + - download_collectd + - install_collectd + diff --git a/ansible/roles/add_heat_stack_owner_role/tasks/main.yml b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml index d751eb032..dda087998 100644 --- a/ansible/roles/add_heat_stack_owner_role/tasks/main.yml +++ b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml @@ -19,6 +19,6 @@ role: heat_stack_owner project: "{{ item }}" with_items: - - demo +# - demo - admin environment: "{{ openrc }}" diff --git a/ansible/roles/download_collectd/defaults/main.yml b/ansible/roles/download_collectd/defaults/main.yml new file mode 100644 index 000000000..d4e91acc4 --- /dev/null +++ b/ansible/roles/download_collectd/defaults/main.yml @@ -0,0 +1,4 @@ +--- +collectd_url: "https://github.com/collectd/collectd.git" +collectd_dest: "{{ clone_dest }}/collectd" +collectd_version: "47c86ace348a1d7a5352a83d10935209f89aa4f5" diff --git a/ansible/roles/download_collectd/tasks/main.yml b/ansible/roles/download_collectd/tasks/main.yml new file mode 100644 index 000000000..785cb3af5 --- /dev/null +++ b/ansible/roles/download_collectd/tasks/main.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +#- debug: +# var: collectd_version +# verbosity: 2 + +- name: fetch collectd + git: + repo: "{{ collectd_url }}" + dest: "{{ collectd_dest }}" + version: "{{ collectd_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + collectd_path: "{{ collectd_dest }}" diff --git a/ansible/roles/download_intel_cmt_cat/defaults/main.yml b/ansible/roles/download_intel_cmt_cat/defaults/main.yml new file mode 100644 index 000000000..d733e4114 --- /dev/null +++ b/ansible/roles/download_intel_cmt_cat/defaults/main.yml @@ -0,0 +1,4 @@ +--- +intel_cmt_cat_url: "https://github.com/01org/intel-cmt-cat.git" +intel_cmt_cat_dest: "{{ clone_dest }}/intel-cmt-cat" +intel_cmt_cat_version: "master" diff --git a/ansible/roles/download_intel_cmt_cat/tasks/main.yml b/ansible/roles/download_intel_cmt_cat/tasks/main.yml new file mode 100644 index 000000000..c1b6f7922 --- /dev/null +++ b/ansible/roles/download_intel_cmt_cat/tasks/main.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +#- debug: +# var: intel_cmt_cat_version +# verbosity: 2 + +- name: fetch intel-cmt-cat + git: + repo: "{{ intel_cmt_cat_url }}" + dest: "{{ intel_cmt_cat_dest }}" + version: "{{ intel_cmt_cat_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + intel_cmt_cat_path: "{{ intel_cmt_cat_dest }}" diff --git a/ansible/roles/download_yajl/defaults/main.yml b/ansible/roles/download_yajl/defaults/main.yml new file mode 100644 index 000000000..10e8c058a --- /dev/null +++ b/ansible/roles/download_yajl/defaults/main.yml @@ -0,0 +1,4 @@ +--- +yajl_url: "https://github.com/yajl/yajl.git" +yajl_dest: "{{ clone_dest }}/yajl" +yajl_version: "master" diff --git a/ansible/roles/download_yajl/tasks/main.yml b/ansible/roles/download_yajl/tasks/main.yml new file mode 100644 index 000000000..0b115d06e --- /dev/null +++ b/ansible/roles/download_yajl/tasks/main.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +#- debug: +# var: yajl_version +# verbosity: 2 + +- name: fetch yajl + git: + repo: "{{ yajl_url }}" + dest: "{{ yajl_dest }}" + version: "{{ yajl_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + yajl_path: "{{ yajl_dest }}" diff --git a/ansible/roles/enable_hugepages_on_boot/defaults/main.yml b/ansible/roles/enable_hugepages_on_boot/defaults/main.yml index 015e01bab..cc89ea346 100644 --- a/ansible/roles/enable_hugepages_on_boot/defaults/main.yml +++ b/ansible/roles/enable_hugepages_on_boot/defaults/main.yml @@ -1,3 +1,10 @@ --- num_hugepages: auto -huge_pagesize_mb: 1024 \ No newline at end of file +huge_pagesize_mb: 1024 +# disable EFI for chroot +efi: + stat: + exists: False +update_grub: + Debian: "grub-mkconfig -o {% if efi.stat.exists %}/boot/efi/EFI/{{ ansible_distribution|lower }}/grub.cfg{% else %}/boot/grub/grub.cfg{% endif %}" + RedHat: "grub2-mkconfig -o {% if efi.stat.exists %}/boot/efi/EFI/{{ ansible_distribution|lower }}/grub.cfg{% else %}/boot/grub2/grub.cfg{% endif %}" diff --git a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml index 6e7657a39..c5c615bb3 100755 --- a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml +++ b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml @@ -17,6 +17,11 @@ register: is_mine_huge ignore_errors: True +# won't work in chroot +#- name: Detect EFI +# stat: path="/sys/firmware/efi" +# register: efi + - name: check if hugepages are set by someone else command: "grep -o 'default_hugepagesz=' /etc/default/grub" register: is_huge diff --git a/ansible/roles/install_collectd/tasks/main.yml b/ansible/roles/install_collectd/tasks/main.yml new file mode 100644 index 000000000..c1ea4d994 --- /dev/null +++ b/ansible/roles/install_collectd/tasks/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present update_cache=yes" + with_items: "{{ collectd_build_dependencies[ansible_os_family] }}" + +- name: prepare autotools + command: ./build.sh + args: + chdir: "{{ collectd_path }}" + +- name: build collectd + shell: "./configure --with-libpqos=/usr/ --with-libdpdk={{ dpdk_shared_path }} --with-libyajl=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats --prefix={{ INSTALL_BIN_PATH }}/collectd |& tee collectd-configure.txt" + args: + executable: /bin/bash + chdir: "{{ collectd_path }}" + +- fetch: + src: "{{ collectd_path }}/collectd-configure.txt" + dest: /tmp + +- name: "make collectd install" + my_make: + chdir: "{{ collectd_path }}" + target: install + diff --git a/ansible/roles/install_collectd/vars/main.yml b/ansible/roles/install_collectd/vars/main.yml new file mode 100644 index 000000000..0cafc80dd --- /dev/null +++ b/ansible/roles/install_collectd/vars/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +collectd_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + diff --git a/ansible/roles/install_dpdk/tasks/main.yml b/ansible/roles/install_dpdk/tasks/main.yml index cab093ad5..e189eb629 100644 --- a/ansible/roles/install_dpdk/tasks/main.yml +++ b/ansible/roles/install_dpdk/tasks/main.yml @@ -70,12 +70,37 @@ regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n' line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y' +# This is requied for collectd? but it breaks PROX? +#- name: enable CONFIG_RTE_BUILD_SHARED_LIB +# lineinfile: +# dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" +# regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n' +# line: 'CONFIG_RTE_BUILD_SHARED_LIB=y' +# +#- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH +# lineinfile: +# dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" +# regexp: '^CONFIG_RTE_EAL_PMD_PATH=""' +# line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"' + +# TODO: disable ASLR + - my_make: chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}" extra_args: "-j {{ ansible_processor_vcpus }}" environment: RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +#- name: make install DPDK into /usr for collectd and other programs +# my_make: +# chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}" +# target: install +# params: "T={{ RTE_TARGET }}" +## params: "prefix={{ usr_prefix }}" +# environment: +# RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +# become: yes + - file: path: "{{ dpdk_module_dir}}" state: directory diff --git a/ansible/roles/install_dpdk/vars/main.yml b/ansible/roles/install_dpdk/vars/main.yml index 1cc4f1583..45bcc339b 100644 --- a/ansible/roles/install_dpdk/vars/main.yml +++ b/ansible/roles/install_dpdk/vars/main.yml @@ -6,3 +6,4 @@ dpdk_devbind: "16.07": "{{ dpdk_path }}/tools/dpdk-devbind.py" "17.02": "{{ dpdk_path }}/usertools/dpdk-devbind.py" "17.04": "{{ dpdk_path }}/usertools/dpdk-devbind.py" +dpdk_pmd_path: /usr/lib/dpdk-pmd/ diff --git a/ansible/roles/install_dpdk_shared/defaults/main.yml b/ansible/roles/install_dpdk_shared/defaults/main.yml new file mode 100644 index 000000000..fe2172401 --- /dev/null +++ b/ansible/roles/install_dpdk_shared/defaults/main.yml @@ -0,0 +1,2 @@ +--- +INSTALL_BIN_PATH: "/opt/nsb_bin" \ No newline at end of file diff --git a/ansible/roles/install_dpdk_shared/tasks/Debian.yml b/ansible/roles/install_dpdk_shared/tasks/Debian.yml new file mode 100755 index 000000000..c77e4f96a --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/Debian.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-dev + +- name: Install kernel headers + action: "{{ ansible_pkg_mgr }} name=linux-headers-{{ dpdk_kernel }} state=present" + diff --git a/ansible/roles/install_dpdk_shared/tasks/RedHat.yml b/ansible/roles/install_dpdk_shared/tasks/RedHat.yml new file mode 100644 index 000000000..ae66faa04 --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/RedHat.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-devel + +# Do this before installing kernel headers +# example: +# kernel-headers-3.10.0-514.2.2.el7.x86_64 for kernel 3.10.0-514.el7.x86_64 +- name: Adjust dpdk_kernel to be match an RPM, remove el7.x86_64 + set_fact: + rpm_kernel: "{{ dpdk_kernel|regex_replace('[.]el\\d+\\.x86_64', '') }}" + +- name: Install kernel headers +# use rpm wildcard + action: "{{ ansible_pkg_mgr }} name=kernel-headers-{{ rpm_kernel }}* state=present" diff --git a/ansible/roles/install_dpdk_shared/tasks/main.yml b/ansible/roles/install_dpdk_shared/tasks/main.yml new file mode 100644 index 000000000..6ed9f3bfc --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/main.yml @@ -0,0 +1,121 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=0 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/rte_pipeline.patch" +# +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=1 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/0*.patch" + +- name: set DPDK shared dir + set_fact: + dpdk_shared_path: "{{ dpdk_path }}-shared" + +- command: "cp -a {{ dpdk_path }} {{ dpdk_shared_path }}" + +- name: find kernel for image, (including chroot) + find_kernel: + kernel: "{{ ansible_kernel }}" + register: found_kernel + +# Do this before installing kernel headers +- name: Set dpdk_kernel to be the kernel we found + set_fact: + dpdk_kernel: "{{ found_kernel.kernel }}" + +- include: "{{ ansible_os_family }}.yml" + +- name: set RTE_KERNELDIR to point to found kernel + set_fact: + RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build" + +- my_make: + chdir: "{{ dpdk_shared_path }}" + target: config + params: + T: "{{ dpdk_make_arch }}" + O: "{{ dpdk_make_arch }}" + extra_args: "-j {{ ansible_processor_vcpus }}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +- name: enable RTE_PORT_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n' + line: 'CONFIG_RTE_PORT_STATS_COLLECT=y' + +- name: enable DPDK RTE_PORT_PCAP + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_PCAP=n' + line: 'CONFIG_RTE_PORT_PCAP=y' + +- name: enable DPDK RTE_TABLE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n' + line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y' + +- name: enable DPDK RTE_PIPELINE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n' + line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y' + +# This is requied for collectd but VNFs can't use shared DPDK +- name: enable CONFIG_RTE_BUILD_SHARED_LIB + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n' + line: 'CONFIG_RTE_BUILD_SHARED_LIB=y' + +- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_EAL_PMD_PATH=""' + line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"' + +- my_make: + chdir: "{{ dpdk_shared_path }}" + target: clean + params: + # no T= target for clean + O: "{{ dpdk_make_arch }}" + extra_args: "-j {{ ansible_processor_vcpus }}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +# TODO: disable ASLR + +- my_make: + chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}" + extra_args: "-j {{ ansible_processor_vcpus }}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +#- name: make install DPDK into /usr for collectd and other programs +# my_make: +# chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}" +# target: install +# params: "T={{ RTE_TARGET }}" +## params: "prefix={{ usr_prefix }}" +# environment: +# RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +# become: yes + +# don't install module or copy dpdk-devbind + diff --git a/ansible/roles/install_dpdk_shared/vars/main.yml b/ansible/roles/install_dpdk_shared/vars/main.yml new file mode 100644 index 000000000..45bcc339b --- /dev/null +++ b/ansible/roles/install_dpdk_shared/vars/main.yml @@ -0,0 +1,9 @@ +--- +dpdk_make_arch: x86_64-native-linuxapp-gcc +dpdk_module_dir: "/lib/modules/{{ dpdk_kernel }}/extra" +hugetable_mount: /mnt/huge +dpdk_devbind: + "16.07": "{{ dpdk_path }}/tools/dpdk-devbind.py" + "17.02": "{{ dpdk_path }}/usertools/dpdk-devbind.py" + "17.04": "{{ dpdk_path }}/usertools/dpdk-devbind.py" +dpdk_pmd_path: /usr/lib/dpdk-pmd/ diff --git a/ansible/roles/install_intel_cmt_cat/tasks/main.yml b/ansible/roles/install_intel_cmt_cat/tasks/main.yml new file mode 100644 index 000000000..fe3bf1464 --- /dev/null +++ b/ansible/roles/install_intel_cmt_cat/tasks/main.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ intel_cmt_cat_build_dependencies[ansible_os_family] }}" + +- name: "make intel-cmt-cat" + my_make: + chdir: "{{ intel_cmt_cat_path }}" + target: install + params: "PREFIX=/usr" + diff --git a/ansible/roles/install_intel_cmt_cat/vars/main.yml b/ansible/roles/install_intel_cmt_cat/vars/main.yml new file mode 100644 index 000000000..20bc1c69c --- /dev/null +++ b/ansible/roles/install_intel_cmt_cat/vars/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +intel_cmt_cat_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + diff --git a/ansible/roles/install_rabbitmq/tasks/main.yml b/ansible/roles/install_rabbitmq/tasks/main.yml new file mode 100644 index 000000000..16195c49d --- /dev/null +++ b/ansible/roles/install_rabbitmq/tasks/main.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: bootstrap rabbitmq project repos + template: "src={{ ansible_os_family }}-repos.j2 dest=/etc/yum.repos.d/rabbitmq_rabbitmq-server.repo" + when: ansible_os_family == 'RedHat' + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" + with_items: "{{ rabbitmq_packages[ansible_os_family] }}" + diff --git a/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 b/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 new file mode 100644 index 000000000..09c997ce1 --- /dev/null +++ b/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 @@ -0,0 +1,21 @@ +[rabbitmq_rabbitmq-server] +name=rabbitmq_rabbitmq-server +baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_distribution_major_version }}/$basearch +repo_gpgcheck=0 +gpgcheck=0 +enabled=1 +gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey +sslverify=0 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt +metadata_expire=300 + +[rabbitmq_rabbitmq-server-source] +name=rabbitmq_rabbitmq-server-source +baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_distribution_major_version }}/SRPMS +repo_gpgcheck=0 +gpgcheck=0 +enabled=1 +gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey +sslverify=0 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt +metadata_expire=300 \ No newline at end of file diff --git a/ansible/roles/install_rabbitmq/vars/main.yml b/ansible/roles/install_rabbitmq/vars/main.yml new file mode 100644 index 000000000..d49607dbf --- /dev/null +++ b/ansible/roles/install_rabbitmq/vars/main.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +rabbitmq_packages: + Debian: + - librabbitmq-dev + - rabbitmq-server + RedHat: + - rabbitmq-server + - librabbitmq-devel + diff --git a/ansible/roles/install_samplevnf/tasks/main.yml b/ansible/roles/install_samplevnf/tasks/main.yml index d332c88bc..b0ea91961 100644 --- a/ansible/roles/install_samplevnf/tasks/main.yml +++ b/ansible/roles/install_samplevnf/tasks/main.yml @@ -36,11 +36,16 @@ when: vnf_name == "PROX" and image_type is defined and image_type == "vm" - name: "make {{ vnf_name }} clean" - my_make: chdir="{{ vnf_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + my_make: + chdir: "{{ vnf_build_dir }}" + target: clean + extra_args: "-j {{ ansible_processor_vcpus }}" environment: "{{ build_env_vars }}" - name: "make {{ vnf_name }}" - my_make: chdir="{{ vnf_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" + my_make: + chdir: "{{ vnf_build_dir }}" + extra_args: "-j {{ ansible_processor_vcpus }}" environment: "{{ build_env_vars }}" #- command: cp "{{ vnf_build_dir }}/{{ vnf_name }}/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vACL_vnf" diff --git a/ansible/roles/install_samplevnf/vars/main.yml b/ansible/roles/install_samplevnf/vars/main.yml index 6f2c44a84..45cea6820 100644 --- a/ansible/roles/install_samplevnf/vars/main.yml +++ b/ansible/roles/install_samplevnf/vars/main.yml @@ -15,6 +15,23 @@ vnf_build_dependencies: PROX: Debian: + - build-essential + - git + - unzip + - libpcap0.8-dev + - gcc + - make + - libc6 + - libc6-dev + - g++-multilib + - libzmq3-dev + - libcurl4-openssl-dev + - net-tools + - wget + - libpcap-dev + - libncurses-dev + - libedit-dev + - pciutils - pkg-config - liblua5.2-dev - libncurses5 diff --git a/ansible/roles/install_yajl/tasks/main.yml b/ansible/roles/install_yajl/tasks/main.yml new file mode 100644 index 000000000..a7eb7961e --- /dev/null +++ b/ansible/roles/install_yajl/tasks/main.yml @@ -0,0 +1,33 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ yajl_build_dependencies[ansible_os_family] }}" + +- name: configure + command: ./configure + args: + chdir: "{{ yajl_path }}" + +- name: "make yajl" + my_make: + chdir: "{{ yajl_path }}" + +- name: "make install yajl" + my_make: + chdir: "{{ yajl_path }}" + target: install + diff --git a/ansible/roles/install_yajl/vars/main.yml b/ansible/roles/install_yajl/vars/main.yml new file mode 100644 index 000000000..1b192e87b --- /dev/null +++ b/ansible/roles/install_yajl/vars/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +yajl_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + diff --git a/ansible/roles/package_clean/tasks/Debian.yml b/ansible/roles/package_clean/tasks/Debian.yml new file mode 100755 index 000000000..abc280076 --- /dev/null +++ b/ansible/roles/package_clean/tasks/Debian.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Purge apt cache + command: apt-get clean diff --git a/ansible/roles/package_clean/tasks/RedHat.yml b/ansible/roles/package_clean/tasks/RedHat.yml new file mode 100644 index 000000000..c6ed62b35 --- /dev/null +++ b/ansible/roles/package_clean/tasks/RedHat.yml @@ -0,0 +1,17 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Clean yum cache + command: "{{ ansible_pkg_mgr }} clean all + diff --git a/ansible/roles/package_clean/tasks/main.yml b/ansible/roles/package_clean/tasks/main.yml new file mode 100644 index 000000000..27660c3ca --- /dev/null +++ b/ansible/roles/package_clean/tasks/main.yml @@ -0,0 +1,15 @@ +# Copyright (c) 2017 Intel Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- include: "{{ ansible_os_family }}.yml" diff --git a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml index 14bdd7eea..17a9d4ca9 100644 --- a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml +++ b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml @@ -40,3 +40,12 @@ vnf_name: FW - role: install_samplevnf vnf_name: CGNATP + # build shared DPDK for collectd only, required DPDK downloaded already + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_yajl + - install_yajl + - download_collectd + - install_collectd diff --git a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml index 2700b810f..fea5f3f27 100644 --- a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml +++ b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml @@ -49,4 +49,12 @@ vnf_name: FW - role: install_samplevnf vnf_name: CGNATP - + # build shared DPDK for collectd only, required DPDK downloaded already + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_yajl + - install_yajl + - download_collectd + - install_collectd -- cgit 1.2.3-korg