add collectd ansible 31/40731/15
authorRoss Brattain <ross.b.brattain@intel.com>
Wed, 30 Aug 2017 07:52:07 +0000 (00:52 -0700)
committerMaciej Skrocki <maciej.skrocki@intel.com>
Thu, 28 Sep 2017 21:45:43 +0000 (14:45 -0700)
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 <ross.b.brattain@intel.com>
Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com>
34 files changed:
ansible/filter_plugins/networks.py
ansible/install_collectd.yml [new file with mode: 0644]
ansible/roles/add_heat_stack_owner_role/tasks/main.yml
ansible/roles/download_collectd/defaults/main.yml [new file with mode: 0644]
ansible/roles/download_collectd/tasks/main.yml [new file with mode: 0644]
ansible/roles/download_intel_cmt_cat/defaults/main.yml [new file with mode: 0644]
ansible/roles/download_intel_cmt_cat/tasks/main.yml [new file with mode: 0644]
ansible/roles/download_yajl/defaults/main.yml [new file with mode: 0644]
ansible/roles/download_yajl/tasks/main.yml [new file with mode: 0644]
ansible/roles/enable_hugepages_on_boot/defaults/main.yml
ansible/roles/enable_hugepages_on_boot/tasks/main.yml
ansible/roles/install_collectd/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_collectd/vars/main.yml [new file with mode: 0644]
ansible/roles/install_dpdk/tasks/main.yml
ansible/roles/install_dpdk/vars/main.yml
ansible/roles/install_dpdk_shared/defaults/main.yml [new file with mode: 0644]
ansible/roles/install_dpdk_shared/tasks/Debian.yml [new file with mode: 0755]
ansible/roles/install_dpdk_shared/tasks/RedHat.yml [new file with mode: 0644]
ansible/roles/install_dpdk_shared/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_dpdk_shared/vars/main.yml [new file with mode: 0644]
ansible/roles/install_intel_cmt_cat/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_intel_cmt_cat/vars/main.yml [new file with mode: 0644]
ansible/roles/install_rabbitmq/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 [new file with mode: 0644]
ansible/roles/install_rabbitmq/vars/main.yml [new file with mode: 0644]
ansible/roles/install_samplevnf/tasks/main.yml
ansible/roles/install_samplevnf/vars/main.yml
ansible/roles/install_yajl/tasks/main.yml [new file with mode: 0644]
ansible/roles/install_yajl/vars/main.yml [new file with mode: 0644]
ansible/roles/package_clean/tasks/Debian.yml [new file with mode: 0755]
ansible/roles/package_clean/tasks/RedHat.yml [new file with mode: 0644]
ansible/roles/package_clean/tasks/main.yml [new file with mode: 0644]
ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml
ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml

index a157395..d67615a 100644 (file)
 # 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 (file)
index 0000000..26d1879
--- /dev/null
@@ -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
+
index d751eb0..dda0879 100644 (file)
@@ -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 (file)
index 0000000..d4e91ac
--- /dev/null
@@ -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 (file)
index 0000000..785cb3a
--- /dev/null
@@ -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 (file)
index 0000000..d733e41
--- /dev/null
@@ -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 (file)
index 0000000..c1b6f79
--- /dev/null
@@ -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 (file)
index 0000000..10e8c05
--- /dev/null
@@ -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 (file)
index 0000000..0b115d0
--- /dev/null
@@ -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 }}"
index 015e01b..cc89ea3 100644 (file)
@@ -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 %}"
index 6e7657a..c5c615b 100755 (executable)
   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 (file)
index 0000000..c1ea4d9
--- /dev/null
@@ -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 (file)
index 0000000..0cafc80
--- /dev/null
@@ -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
+
index cab093a..e189eb6 100644 (file)
     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
index 1cc4f15..45bcc33 100644 (file)
@@ -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 (file)
index 0000000..fe21724
--- /dev/null
@@ -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 (executable)
index 0000000..c77e4f9
--- /dev/null
@@ -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 (file)
index 0000000..ae66faa
--- /dev/null
@@ -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 (file)
index 0000000..6ed9f3b
--- /dev/null
@@ -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 (file)
index 0000000..45bcc33
--- /dev/null
@@ -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 (file)
index 0000000..fe3bf14
--- /dev/null
@@ -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 (file)
index 0000000..20bc1c6
--- /dev/null
@@ -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 (file)
index 0000000..16195c4
--- /dev/null
@@ -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 (file)
index 0000000..09c997c
--- /dev/null
@@ -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 (file)
index 0000000..d49607d
--- /dev/null
@@ -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
+
index d332c88..b0ea919 100644 (file)
   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"
index 6f2c44a..45cea68 100644 (file)
 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 (file)
index 0000000..a7eb796
--- /dev/null
@@ -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 (file)
index 0000000..1b192e8
--- /dev/null
@@ -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 (executable)
index 0000000..abc2800
--- /dev/null
@@ -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 (file)
index 0000000..c6ed62b
--- /dev/null
@@ -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 (file)
index 0000000..27660c3
--- /dev/null
@@ -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"
index 14bdd7e..17a9d4c 100644 (file)
       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
index 2700b81..fea5f3f 100644 (file)
       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