Update install.yaml with image generation: nsb and normal.
JIRA: YARDSTICK-1198
Change-Id: I3b8773e9b3b9890ae8623bb6536d05f1151d84a8
Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
---\r
target_os: "Ubuntu"\r
YARD_IMG_ARCH: "amd64"\r
+IMG_PROPERTY: "normal"\r
clone_dest: /opt/tempT\r
release: xenial\r
normal_image_file: "{{ workspace }}/yardstick-image.img"\r
nsb_image_file: "{{ workspace }}/yardstick-nsb-image.img"\r
ubuntu_image_file: /tmp/workspace/yardstick/yardstick-trusty-server.raw\r
-proxy_env: {}\r
+proxy_env:\r
+ PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin\r
+ http_proxy: "{{ lookup('env', 'http_proxy') }}"\r
+ https_proxy: "{{ lookup('env', 'https_proxy') }}"\r
+ ftp_proxy: "{{ lookup('env', 'ftp_proxy') }}"\r
+ no_proxy: "{{ lookup('env', 'no_proxy') }}"\r
# the group of systems on which to install yardstick
# by default just localhost
[jumphost]
-#yardstickvm1 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=local
localhost ansible_connection=local
# section below is only due backward compatibility.
jumphost
[yardstick-standalone]
-#yardstickvm2 ansible_host=192.168.2.51 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
-# uncomment hosts below if you would to test yardstick-standalone/sriov scenarios
-#yardstick-standalone-node ansible_host=192.168.1.2
-#yardstick-standalone-node-2 ansible_host=192.168.1.3
+# standalone-node ansible_host=192.168.2.51 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
[yardstick-baremetal]
-#yardstickvm3 ansible_host=192.168.2.52 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
-# hostname ansible_host=192.168.1.2
+# baremetal-node ansible_host=192.168.2.52 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
[all:vars]
arch_amd64=amd64
inst_mode_container=container
inst_mode_baremetal=baremetal
ubuntu_archive={"amd64": "http://archive.ubuntu.com/ubuntu/", "arm64": "http://ports.ubuntu.com/ubuntu-ports/"}
-# uncomment credentials below for yardstick-standalone
-#ansible_user=root
-#ansible_pass=root
+# Uncomment credentials below if needed
+# ansible_user=root
+# ansible_pass=root
- shell: uwsgi -i /etc/yardstick/yardstick.ini
when: installation_mode != inst_mode_container
-- name: Prepare baremetal and standalone server(s)
+
+- name: Prepare baremetal and standalone servers
hosts: yardstick-baremetal,yardstick-standalone
become: yes
- vars:
- YARD_IMG_ARCH: "{{ arch_amd64 }}"
- environment:
- proxy_env:
- http_proxy: "{{ lookup('env', 'http_proxy') }}"
- https_proxy: "{{ lookup('env', 'https_proxy') }}"
- ftp_proxy: "{{ lookup('env', 'ftp_proxy') }}"
- no_proxy: "{{ lookup('env', 'no_proxy') }}"
+ environment: "{{ proxy_env }}"
roles:
- add_custom_repos
- role: set_package_installer_proxy
when: proxy_env is defined and proxy_env
# can't update grub in chroot/docker
+ # ?? - enable_iommu_on_boot
- enable_hugepages_on_boot
# needed for collectd plugins
- increase_open_file_limits
- install_pmu_tools
- download_collectd
- install_collectd
+
+
+- hosts: jumphost
+ become: yes
+ vars:
+ img_prop_item: "{{ IMG_PROPERTY }}"
+ img_arch: "{{ YARD_IMG_ARCH }}"
+
+ tasks:
+ - name: Include pre-build
+ include_role:
+ name: build_yardstick_image
+ tasks_from: pre_build.yml
+
+
+- hosts: chroot_image
+ connection: chroot
+ become: yes
+ vars:
+ img_property: "{{ IMG_PROPERTY }}"
+ environment: "{{ proxy_env }}"
+
+ tasks:
+ - name: Include image build
+ include_role:
+ name: build_yardstick_image
+ tasks_from: "cloudimg_modify_{{ img_property }}.yml"
+
+
+- hosts: jumphost
+ become: yes
+
+ tasks:
+ - name: Include post-build
+ include_role:
+ name: build_yardstick_image
+ tasks_from: post_build.yml
# See the License for the specific language governing permissions and
# limitations under the License.
---
-- include: "{{ target_os|lower }}.yml"
+- include_tasks: "{{ target_os|lower }}.yml"
--- /dev/null
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
+- debug:\r
+ msg: "chrooted in {{ inventory_hostname }}"\r
+\r
+- debug:\r
+ var: proxy_env\r
+ verbosity: 2\r
+\r
+- include_role:\r
+ name: "{{ role_item }}"\r
+ with_items:\r
+ - reset_resolv_conf\r
+ - add_custom_repos\r
+ - modify_cloud_config\r
+ loop_control:\r
+ loop_var: role_item\r
+\r
+- include_role:\r
+ name: set_package_installer_proxy\r
+ when: proxy_env is defined and proxy_env\r
+\r
+- include_role:\r
+ name: install_image_dependencies\r
+\r
+- include_vars: roles/download_unixbench/defaults/main.yml\r
+ when: unixbench_dest is undefined\r
+\r
+- include_vars: roles/download_ramspeed/defaults/main.yml\r
+ when: ramspeed_dest is undefined\r
+\r
+- include_role:\r
+ name: "{{ role_item }}"\r
+ with_items:\r
+ - download_l2fwd\r
+ - download_unixbench\r
+ - install_unixbench\r
+ - download_ramspeed\r
+ - install_ramspeed\r
+ - download_cachestat\r
+ loop_control:\r
+ loop_var: role_item\r
+\r
+ environment: "{{ proxy_env }}"\r
--- /dev/null
+# Copyright (c) 2018 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:
+ msg: "chrooted in {{ inventory_hostname }}"
+
+- debug:
+ var: proxy_env
+ verbosity: 2
+
+- debug: msg="play_hosts={{play_hosts}}"
+
+- include_role:
+ name: "{{ role_item }}"
+ with_items:
+ - reset_resolv_conf
+ - add_custom_repos
+ - modify_cloud_config
+ loop_control:
+ loop_var: role_item
+
+- include_role:
+ name: set_package_installer_proxy
+ when: proxy_env is defined and proxy_env
+
+- include_vars: roles/install_dpdk/vars/main.yml
+ when: dpdk_make_arch is undefined
+
+- include_vars: roles/download_dpdk/defaults/main.yml
+ when: dpdk_version is undefined
+
+- include_vars: roles/download_trex/defaults/main.yml
+ when: trex_unarchive is undefined
+
+- include_vars: roles/download_civetweb/defaults/main.yml
+ when: civetweb_dest is undefined
+
+- include_role:
+ name: "{{ role_item }}"
+ with_items:
+ - install_image_dependencies
+ - enable_hugepages_on_boot # can't update grub in chroot/docker
+ - increase_open_file_limits # needed for collectd plugins
+ - download_dpdk
+ - install_dpdk
+ - download_trex
+ - install_trex
+ - download_pktgen
+ - install_pktgen
+ - download_civetweb
+ - install_civetweb
+ - download_samplevnfs
+ loop_control:
+ loop_var: role_item
+ environment: "{{ proxy_env }}"
+
+- include_vars: roles/install_dpdk/defaults/main.yml
+ when: INSTALL_BIN_PATH is undefined
+
+- include_vars: roles/download_samplevnfs/defaults/main.yml
+ when: samplevnf_dest is undefined
+- set_fact:
+ samplevnf_path: "{{ samplevnf_dest }}"
+- include_role:
+ name: install_samplevnf
+ with_items:
+ - PROX
+ - UDP_Replay
+ - ACL
+ - FW
+ - CGNAPT
+ loop_control:
+ loop_var: vnf_name
+
+- include_vars: roles/download_drivers/defaults/main.yml
+ when: i40evf_path is undefined
+
+- include_role:
+ name: "{{ role_item }}"
+ with_items:
+ - install_dpdk_shared # build shared DPDK for collectd only, required DPDK downloaded already
+ - install_rabbitmq
+ - download_intel_cmt_cat
+ - install_intel_cmt_cat
+ - download_pmu_tools
+ - install_pmu_tools
+ - download_collectd
+ - install_collectd
+ - download_drivers
+ - install_drivers
+ loop_control:
+ loop_var: role_item
+ environment: "{{ proxy_env }}"
--- /dev/null
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
--- /dev/null
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
+- name: convert image to image file\r
+ command: qemu-img convert -c -o compat=0.10 -O qcow2 {{ raw_imgfile }} {{ imgfile }}\r
+\r
+# Post build yardstick image\r
+- group_by:\r
+ key: image_builder\r
+\r
+- name: remove ubuntu policy-rc.d workaround\r
+ file:\r
+ path: "{{ mountdir }}/usr/sbin/policy-rc.d"\r
+ state: absent\r
+ when: "target_os == 'Ubuntu'"\r
+\r
+- name: cleanup fake tmp fstab\r
+ file:\r
+ path: "{{ fake_fstab }}"\r
+ state: absent\r
+\r
+- mount:\r
+ name: "{{ mountdir }}/proc"\r
+ state: unmounted\r
+\r
+- mount:\r
+ name: "{{ mountdir }}"\r
+ state: unmounted\r
+\r
+- name: kpartx -dv to delete all image partition device nodes\r
+ command: kpartx -dv "{{ raw_imgfile }}"\r
+ ignore_errors: true\r
+\r
+- debug:\r
+ msg: "yardstick image = {{ imgfile }}"\r
--- /dev/null
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
+- name: Group\r
+ group_by:\r
+ key: image_builder\r
+\r
+- package: name=parted state=present\r
+ environment: "{{ proxy_env }}"\r
+\r
+- package: name=kpartx state=present\r
+ environment: "{{ proxy_env }}"\r
+\r
+- package: name="{{ growpart_package[ansible_os_family] }}" state=present\r
+ environment: "{{ proxy_env }}"\r
+\r
+- set_fact:\r
+ imgfile: "{{ normal_image_file }}"\r
+ when: img_prop_item == "normal"\r
+\r
+- set_fact:\r
+ imgfile: "{{ nsb_image_file }}"\r
+ when: img_prop_item == "nsb"\r
+\r
+- set_fact:\r
+ mountdir: "{{ lookup('env', 'mountdir')|default('/mnt/yardstick', true) }}"\r
+ raw_imgfile: "{{ workspace }}/{{ raw_imgfile_basename }}"\r
+\r
+# cleanup non-lxd\r
+- name: unmount all old mount points\r
+ mount:\r
+ name: "{{ item }}"\r
+ state: unmounted\r
+ with_items:\r
+ # order matters\r
+ - "{{ mountdir }}/proc"\r
+ - "{{ mountdir }}"\r
+ - "/mnt/{{ release }}"\r
+\r
+- name: kpartx -dv to delete all image partition device nodes\r
+ command: kpartx -dv "{{ raw_imgfile }}"\r
+ ignore_errors: true\r
+\r
+- name: Debug dump loop devices\r
+ command: losetup -a\r
+ ignore_errors: true\r
+\r
+- name: delete loop devices for image file\r
+ # use this because kpartx -dv will fail if raw_imgfile was delete\r
+ # but in theory we could have deleted file still attached to loopback device?\r
+ # use grep because of // and awk\r
+ shell: losetup -O NAME,BACK-FILE | grep "{{ raw_imgfile_basename }}" | awk '{ print $1 }' | xargs -l1 losetup -v -d\r
+ ignore_errors: true\r
+\r
+- name: Debug dump loop devices again\r
+ command: losetup -a\r
+ ignore_errors: true\r
+\r
+- name: delete {{ raw_imgfile }}\r
+ file:\r
+ path: "{{ raw_imgfile }}"\r
+ state: absent\r
+\r
+# common\r
+- name: remove {{ mountdir }}\r
+ file:\r
+ path: "{{ mountdir }}"\r
+ state: absent\r
+\r
+# download-common\r
+- name: remove {{ workspace }}\r
+ file:\r
+ path: "{{ workspace }}"\r
+ state: directory\r
+\r
+- name: "fetch {{ image_url }} and verify "\r
+ fetch_url_and_verify:\r
+ url: "{{ image_url }}"\r
+ sha256url: "{{ sha256sums_url }}"\r
+ dest: "{{ image_dest }}"\r
+\r
+- name: convert image to raw\r
+ command: "qemu-img convert {{ image_dest }} {{ raw_imgfile }}"\r
+\r
+- name: resize image to allow for more VNFs\r
+ command: "qemu-img resize -f raw {{ raw_imgfile }} +2G"\r
+\r
+- name: resize parition to allow for more VNFs\r
+ # use growpart because maybe it handles GPT better than parted\r
+ command: growpart {{ raw_imgfile }} 1\r
+\r
+- name: create mknod devices in chroot\r
+ command: "mknod -m 0660 /dev/loop{{ item }} b 7 {{ item }}"\r
+ args:\r
+ creates: "/dev/loop{{ item }}"\r
+ with_sequence: start=0 end=9\r
+ tags: mknod_devices\r
+\r
+- name: find first partition device\r
+ command: kpartx -l "{{ raw_imgfile }}"\r
+ register: kpartx_res\r
+\r
+- set_fact:\r
+ image_first_partition: "{{ kpartx_res.stdout_lines[0].split()[0] }}"\r
+\r
+- set_fact:\r
+ # assume / is the first partition\r
+ image_first_partition_device: "/dev/mapper/{{ image_first_partition }}"\r
+\r
+- name: use kpartx to create device nodes for the raw image loop device\r
+ # operate on the loop device to avoid /dev namespace missing devices\r
+ command: kpartx -avs "{{ raw_imgfile }}"\r
+\r
+- name: parted dump raw image\r
+ command: parted "{{ raw_imgfile }}" print\r
+ register: parted_res\r
+\r
+- debug:\r
+ var: parted_res\r
+ verbosity: 2\r
+\r
+- name: use blkid to find filesystem type of first partition device\r
+ command: blkid -o value -s TYPE {{ image_first_partition_device }}\r
+ register: blkid_res\r
+\r
+- set_fact:\r
+ image_fs_type: "{{ blkid_res.stdout.strip() }}"\r
+\r
+- fail:\r
+ msg: "We only support ext4 image filesystems because we have to resize"\r
+ when: image_fs_type != "ext4"\r
+\r
+- name: fsck the image filesystem\r
+ command: "e2fsck -y -f {{ image_first_partition_device }}"\r
+\r
+- name: resize filesystem to full partition size\r
+ command: resize2fs {{ image_first_partition_device }}\r
+\r
+- name: fsck the image filesystem\r
+ command: "e2fsck -y -f {{ image_first_partition_device }}"\r
+\r
+- name: make tmp disposable fstab\r
+ command: mktemp --tmpdir fake_fstab.XXXXXXXXXX\r
+ register: mktemp_res\r
+\r
+- set_fact:\r
+ fake_fstab: "{{ mktemp_res.stdout.strip() }}"\r
+\r
+- name: mount first parition on image device\r
+ mount:\r
+ src: "{{ image_first_partition_device }}"\r
+ name: "{{ mountdir }}"\r
+ # fstype is required\r
+ fstype: "{{ image_fs_type }}"\r
+ # !!!!!!! this is required otherwise we add entries to /etc/fstab\r
+ # and prevent the system from booting\r
+ fstab: "{{ fake_fstab }}"\r
+ state: mounted\r
+\r
+- name: mount chroot /proc\r
+ mount:\r
+ src: none\r
+ name: "{{ mountdir }}/proc"\r
+ fstype: proc\r
+ # !!!!!!! this is required otherwise we add entries to /etc/fstab\r
+ # and prevent the system from booting\r
+ fstab: "{{ fake_fstab }}"\r
+ state: mounted\r
+\r
+- name: if arm copy qemu-aarch64-static into chroot\r
+ copy:\r
+ src: /usr/bin/qemu-aarch64-static\r
+ dest: "{{ mountdir }}/usr/bin"\r
+ when: img_arch == arch_arm64\r
+\r
+- name: create ubuntu policy-rc.d workaround\r
+ copy:\r
+ content: "{{ '#!/bin/sh\nexit 101\n' }}"\r
+ dest: "{{ mountdir }}/usr/sbin/policy-rc.d"\r
+ mode: 0755\r
+ when: "target_os == 'Ubuntu'"\r
+\r
+- name: add chroot as host\r
+ add_host:\r
+ name: "{{ mountdir }}"\r
+ groups: chroot_image,image_builder\r
+ connection: chroot\r
+ ansible_python_interpreter: /usr/bin/python3\r
+ # set this host variable here\r
+ nameserver_ip: "{{ ansible_dns.nameservers[0] }}"\r
+ image_type: vm\r
--- /dev/null
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
+boot_modes:\r
+ 'amd64': disk1\r
+ 'arm64': uefi1\r
+boot_mode: "{{ boot_modes[YARD_IMG_ARCH] }}"\r
+image_filename: "{{ release }}-server-cloudimg-{{ YARD_IMG_ARCH }}-{{ boot_mode }}.img"\r
+image_path: "{{ release }}/current/{{ image_filename }}"\r
+host: "{{ lookup('env', 'HOST')|default('cloud-images.ubuntu.com', true)}}"\r
+image_url: "{{ lookup('env', 'IMAGE_URL')|default('https://' ~ host ~ '/' ~ image_path, true) }}"\r
+image_dest: "{{ workspace }}/{{ image_filename }}"\r
+sha256sums_path: "{{ release }}/current/SHA256SUMS"\r
+sha256sums_filename: "{{ sha256sums_path|basename }}"\r
+sha256sums_url: "{{ lookup('env', 'SHA256SUMS_URL')|default('https://' ~ host ~ '/' ~ sha256sums_path, true) }}"\r
+workspace: "{{ lookup('env', 'workspace')|default('/tmp/workspace/yardstick', true) }}"\r
+raw_imgfile_basename: "yardstick-{{ release }}-server.raw"\r
+growpart_package:\r
+ RedHat: cloud-utils-growpart\r
+ Debian: cloud-guest-utils\r
---
-dpdk_version: "17.02.1"
+dpdk_version: "17.05"
dpdk_url: "http://fast.dpdk.org/rel/dpdk-{{ dpdk_version }}.tar.xz"
dpdk_file: "{{ dpdk_url|basename }}"
dpdk_unarchive: "{{ dpdk_file|regex_replace('[.]tar[.]xz$', '') }}"
civetweb_dest: "{{ clone_dest }}/civetweb"
civetweb_build_dependencies:
Debian:
- - libjson-c-dev=0.11-4ubuntu2
- - libjson0
- - libjson0-dev
+# - libjson-c-dev=0.11-4ubuntu2
+# - libjson0
+# - libjson0-dev
- libssl-dev
+ - libjson-c-dev
RedHat:
action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes"
register: pkg_mgr_results
retries: "{{ pkg_mgr_retries }}"
- until: pkg_mgr_results|success
+ until: pkg_mgr_results is success
with_items: "{{ install_dependencies[ansible_os_family] }}"