aboutsummaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/build_vm.yml44
-rw-r--r--ansible/group_vars/all.yml9
-rw-r--r--ansible/install-inventory.ini20
-rw-r--r--ansible/install.yaml79
-rw-r--r--ansible/roles/build_yardstick_image/tasks/post_build.yml21
-rw-r--r--ansible/roles/build_yardstick_image/tasks/pre_build.yml12
-rw-r--r--ansible/roles/download_civetweb/tasks/main.yml4
-rw-r--r--ansible/roles/download_dpdk/tasks/main.yml4
-rw-r--r--ansible/roles/download_drivers/tasks/i40evf.yml4
-rw-r--r--ansible/roles/download_l2fwd/tasks/main.yml4
-rw-r--r--ansible/roles/download_pktgen/tasks/main.yml4
-rw-r--r--ansible/roles/download_trex/tasks/main.yml4
-rwxr-xr-xansible/roles/enable_hugepages_on_boot/tasks/main.yml34
-rw-r--r--ansible/roles/enable_iommu_on_boot/tasks/main.yml37
-rw-r--r--ansible/roles/install_image_dependencies/defaults/main.yml2
15 files changed, 190 insertions, 92 deletions
diff --git a/ansible/build_vm.yml b/ansible/build_vm.yml
new file mode 100644
index 000000000..9774f9ff5
--- /dev/null
+++ b/ansible/build_vm.yml
@@ -0,0 +1,44 @@
+- name: Prepare to build VM
+ 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
+ when:
+ - installation_mode != inst_mode_container
+
+
+- name: Build VM in chroot
+ 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"
+ when:
+ - installation_mode != inst_mode_container
+
+
+- name: Clear up after VM is built
+ hosts: jumphost
+ become: yes
+
+ tasks:
+ - name: Include post-build
+ include_role:
+ name: build_yardstick_image
+ tasks_from: post_build.yml
+ when:
+ - installation_mode != inst_mode_container
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index cd12bf02e..e94d24023 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -7,7 +7,16 @@ release: "{{ OS_RELEASE | default('xenial') }}"
normal_image_file: "{{ workspace }}/yardstick-image.img"
nsb_image_file: "{{ workspace }}/yardstick-nsb-image.img"
ubuntu_image_file: /tmp/workspace/yardstick/yardstick-trusty-server.raw
+arch_amd64: "amd64"
+arch_arm64: "arm64"
+inst_mode_baremetal: "baremetal"
+inst_mode_container: "container"
+inst_mode_container_pull: "container_pull"
+ubuntu_archive:
+ "amd64": "http://archive.ubuntu.com/ubuntu/"
+ "arm64": "http://ports.ubuntu.com/ubuntu-ports/"
installation_mode: "{{ INSTALLATION_MODE | default('baremetal') }}"
+yardstick_dir: "{{ YARDSTICK_DIR | default('/home/opnfv/repos/yardstick') }}"
proxy_env:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin
http_proxy: "{{ lookup('env', 'http_proxy') }}"
diff --git a/ansible/install-inventory.ini b/ansible/install-inventory.ini
index bcd57db65..07d2c13f4 100644
--- a/ansible/install-inventory.ini
+++ b/ansible/install-inventory.ini
@@ -8,24 +8,20 @@ localhost ansible_connection=local
[yardstick:children]
jumphost
-[yardstick-standalone]
-# standalone-node ansible_host=192.168.2.51 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
-
[yardstick-baremetal]
-# baremetal-node ansible_host=192.168.2.52 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
+# baremetal-node ansible_host=192.168.2.51 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
+
+[yardstick-standalone]
+# standalone-node ansible_host=192.168.2.52 ansible_user=ubuntu ansible_ssh_pass=password ansible_connection=ssh
[all:vars]
-arch_amd64=amd64
-arch_arm64=arm64
-inst_mode_baremetal=baremetal
-inst_mode_container=container
-inst_mode_container_pull=container_pull
-ubuntu_archive={"amd64": "http://archive.ubuntu.com/ubuntu/", "arm64": "http://ports.ubuntu.com/ubuntu-ports/"}
-# When IMG_PROPERTY is passed neither normal nor nsb set "path_to_vm=/path/to/image" to add it to OpenStack
-# path_to_img=/tmp/workspace/yardstick-image.img
# Uncomment credentials below if needed
# ansible_user=root
# ansible_ssh_pass=root
+# ansible_ssh_private_key_file=/root/.ssh/id_rsa
+
+# When IMG_PROPERTY is passed neither normal nor nsb set "path_to_vm=/path/to/image" to add it to OpenStack
+# path_to_img=/tmp/workspace/yardstick-image.img
# List of CPUs to be isolated (not used by default)
# Grub line will be extended with: "isolcpus=<ISOL_CPUS> nohz=on nohz_full=<ISOL_CPUS> rcu_nocbs=1<ISOL_CPUS>"
diff --git a/ansible/install.yaml b/ansible/install.yaml
index 558c48609..a78a11f68 100644
--- a/ansible/install.yaml
+++ b/ansible/install.yaml
@@ -15,7 +15,6 @@
- hosts: jumphost
become: yes
vars:
- yardstick_dir: "{{ YARDSTICK_DIR | default('/home/opnfv/repos/yardstick') }}"
virtual_environment: "{{ VIRTUAL_ENVIRONMENT | default(False) }}"
nsb_dir: "{{ NSB_DIR | default('/opt/nsb_bin/') }}"
@@ -105,54 +104,59 @@
- docker
- barometer_collectd
-
- name: Prepare to build VM
- hosts: jumphost
+ hosts: yardstick-standalone
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
- when:
- - installation_mode != inst_mode_container
- - IMG_PROPERTY == 'nsb' or IMG_PROPERTY == 'normal'
-
-
-- name: Build VM in chroot
- 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"
+ - file:
+ dest: /tmp/ansible
+ state: directory
+ mode: 0755
+
+ - name: Copy ansible folder to remote DUT
+ copy:
+ src: "."
+ dest: /tmp/ansible
+
+ - name: Install DUT related packages
+ apt:
+ name: "{{ packages }}"
+ vars:
+ packages:
+ - qemu-kvm
+ - libvirt-bin
+ - bridge-utils
+ - fping
+ - genisoimage
+
+ # There is a bug with the easy install ansible module in Ubuntu 16.04 linux.
+ # Refer https://github.com/ansible/ansible/issues/23534
+ - name: Install pip
+ shell: easy_install -U pip
when:
- - installation_mode != inst_mode_container
- - IMG_PROPERTY == 'nsb' or IMG_PROPERTY == 'normal'
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_major_version|int <= 16
+ - name: Install python-pip
+ action: "{{ ansible_pkg_mgr }} name=python-pip state=present"
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_major_version|int >= 17
-- name: Clear up after VM is built
- hosts: jumphost
- become: yes
+ - name: Update pip ansible docker
+ pip:
+ name: "ansible==2.5.5"
- tasks:
- - name: Include post-build
- include_role:
- name: build_yardstick_image
- tasks_from: post_build.yml
- when:
- - installation_mode != inst_mode_container
- - IMG_PROPERTY == 'nsb' or IMG_PROPERTY == 'normal'
+ # This is used as workaround as ansible doesn't support chroot on remote server
+ - name: Run ansible on remote
+ shell: "ansible-playbook -e OS_RELEASE={{ OS_RELEASE }} -e IMAGE_PROPERTY={{ IMAGE_PROPERTY }} -e YARD_IMAGE_ARCH={{ YARD_IMAGE_ARCH }} -i install-inventory.ini build_vm.yml -vv"
+ args:
+ chdir: "/tmp/ansible"
- name: Add OpenStack variables, image
@@ -216,6 +220,5 @@
volumes:
- "{{ openrc_file|default('/dev/null') }}:/etc/yardstick/openstack.creds:ro"
- /var/run/docker.sock:/var/run/docker.sock
- - /opt:/opt
- /etc/localtime:/etc/localtime:ro
when: installation_mode == inst_mode_container_pull
diff --git a/ansible/roles/build_yardstick_image/tasks/post_build.yml b/ansible/roles/build_yardstick_image/tasks/post_build.yml
index c6888f8df..abbf57c03 100644
--- a/ansible/roles/build_yardstick_image/tasks/post_build.yml
+++ b/ansible/roles/build_yardstick_image/tasks/post_build.yml
@@ -35,6 +35,10 @@
state: unmounted
- mount:
+ name: "{{ mountdir }}/run"
+ state: unmounted
+
+- mount:
name: "{{ mountdir }}"
state: unmounted
@@ -44,3 +48,20 @@
- debug:
msg: "yardstick image = {{ imgfile }}"
+
+- set_fact:
+ imgdest: "/var/lib/libvirt/images/{{ imgfile | basename}}"
+ name: "{{ (imgfile | basename | splitext)[0] }}"
+ ext: "{{ (imgfile | basename | splitext)[1] }}"
+
+- name: Verify if imgfile exists in libvirt images
+ stat:
+ path: "{{ imgdest }}"
+ register: imgdest_stat
+
+- set_fact:
+ imgdest: "/var/lib/libvirt/images/{{ name }}_autogen{{ ext }}"
+ when: imgdest_stat.stat.exists
+
+- name: Copy image to libvirt images
+ shell: "cp {{ imgfile }} {{ imgdest }}"
diff --git a/ansible/roles/build_yardstick_image/tasks/pre_build.yml b/ansible/roles/build_yardstick_image/tasks/pre_build.yml
index 2dae38060..3ac8e90e9 100644
--- a/ansible/roles/build_yardstick_image/tasks/pre_build.yml
+++ b/ansible/roles/build_yardstick_image/tasks/pre_build.yml
@@ -45,6 +45,7 @@
with_items:
# order matters
- "{{ mountdir }}/proc"
+ - "{{ mountdir }}/run"
- "{{ mountdir }}"
- "/mnt/{{ release }}"
@@ -178,6 +179,17 @@
fstab: "{{ fake_fstab }}"
state: mounted
+- name: mount chroot /run
+ mount:
+ src: /run
+ name: "{{ mountdir }}/run"
+ fstype: tmpfs
+ opts: bind
+ # !!!!!!! this is required otherwise we add entries to /etc/fstab
+ # and prevent the system from booting
+ fstab: "{{ fake_fstab }}"
+ state: mounted
+
- name: if arm copy qemu-aarch64-static into chroot
copy:
src: /usr/bin/qemu-aarch64-static
diff --git a/ansible/roles/download_civetweb/tasks/main.yml b/ansible/roles/download_civetweb/tasks/main.yml
index 03dd3ccd3..b6a475774 100644
--- a/ansible/roles/download_civetweb/tasks/main.yml
+++ b/ansible/roles/download_civetweb/tasks/main.yml
@@ -18,6 +18,10 @@
dest: "{{ clone_dest }}/"
validate_certs: False
checksum: "{{ civetweb_sha256s }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- name: unarchive civetweb
unarchive:
diff --git a/ansible/roles/download_dpdk/tasks/main.yml b/ansible/roles/download_dpdk/tasks/main.yml
index 55b466cb7..e434536a3 100644
--- a/ansible/roles/download_dpdk/tasks/main.yml
+++ b/ansible/roles/download_dpdk/tasks/main.yml
@@ -26,6 +26,10 @@
dest: "{{ dpdk_dest }}"
validate_certs: False
checksum: "{{ dpdk_md5[dpdk_version] }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- unarchive:
src: "{{ dpdk_dest }}/{{ dpdk_file }}"
diff --git a/ansible/roles/download_drivers/tasks/i40evf.yml b/ansible/roles/download_drivers/tasks/i40evf.yml
index cb8a09d6c..48a0330ab 100644
--- a/ansible/roles/download_drivers/tasks/i40evf.yml
+++ b/ansible/roles/download_drivers/tasks/i40evf.yml
@@ -23,6 +23,10 @@
dest: "{{ i40evf_dest }}/{{ i40evf_gzfile }}"
validate_certs: False
checksum: "{{ i40evf_checksum[i40evf_version] }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- name: Unarchive the i40evf file
unarchive:
diff --git a/ansible/roles/download_l2fwd/tasks/main.yml b/ansible/roles/download_l2fwd/tasks/main.yml
index 7f2ea25c4..43b0ec366 100644
--- a/ansible/roles/download_l2fwd/tasks/main.yml
+++ b/ansible/roles/download_l2fwd/tasks/main.yml
@@ -20,6 +20,10 @@
get_url:
url: "{{ l2fwd_url }}"
dest: "{{ l2fwd_dest }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- unarchive:
src: "{{ l2fwd_dest }}/{{ l2fwd_file }}"
diff --git a/ansible/roles/download_pktgen/tasks/main.yml b/ansible/roles/download_pktgen/tasks/main.yml
index ff71f207d..b5ac8cfe8 100644
--- a/ansible/roles/download_pktgen/tasks/main.yml
+++ b/ansible/roles/download_pktgen/tasks/main.yml
@@ -22,6 +22,10 @@
dest: "{{ pktgen_dest }}"
validate_certs: False
checksum: "{{ pktgen_sha256s[pktgen_version] }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- unarchive:
src: "{{ pktgen_dest }}/{{ pktgen_file }}"
diff --git a/ansible/roles/download_trex/tasks/main.yml b/ansible/roles/download_trex/tasks/main.yml
index 9df67d939..44449a9c0 100644
--- a/ansible/roles/download_trex/tasks/main.yml
+++ b/ansible/roles/download_trex/tasks/main.yml
@@ -23,6 +23,10 @@
dest: "{{ trex_dest }}"
validate_certs: False
checksum: "{{ trex_sha256s[trex_version] }}"
+ register: package_result
+ until: package_result is succeeded
+ retries: 10
+ delay: 5
- name: unarchive Trex
unarchive:
diff --git a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml
index 75526eb19..f84e07545 100755
--- a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml
+++ b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Intel Corporation
+# Copyright (c) 2017-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
-- name: check if hugepages are set by this role
+- name: Check if hugepages are set by this role
command: "grep -o '{{ hugepage_param_regex }}' /etc/default/grub"
register: is_mine_huge
ignore_errors: True
@@ -22,46 +22,32 @@
# stat: path="/sys/firmware/efi"
# register: efi
-- name: check if hugepages are set by someone else
+- name: Check if hugepages are set by someone else
command: "grep -o 'default_hugepagesz=' /etc/default/grub"
register: is_huge
ignore_errors: True
-- fail:
+- debug:
msg: "Hugepages already set by someone else"
when: is_mine_huge.stdout == "" and is_huge.stdout != ""
-- name: configure hugepages as idempotent block
+- name: Configure hugepages as idempotent block
block:
- - name: use 8 for auto num_hugepages and 1G size
+ - name: Use 8 for auto num_hugepages and 1G size
set_fact:
num_hugepages: 8
when: num_hugepages|default("auto") == "auto"
- - name: set hugepages in grub
+ - name: Set hugepages in grub
lineinfile:
dest: /etc/default/grub
regexp: '{{ hugepage_param_regex }}'
line: '{{ hugepage_param }}'
state: present
- - name: create hugetables mount
- file:
- path: "{{ hugetable_mount }}"
- state: directory
-
- - name: mount hugetlbfs
- mount:
- name: "{{ hugetable_mount }}"
- src: nodev
- fstype: hugetlbfs
- state: present
-
- - service:
- name: procps
- enabled: yes
-
- include: manual_modify_grub.yml
# only tested on Ubuntu, kernel line is probably different on other distros
when: ansible_distribution == "Ubuntu"
- when: is_mine_huge.stdout == ""
+ when:
+ - is_mine_huge.stdout == ""
+ - is_huge.stdout == ""
diff --git a/ansible/roles/enable_iommu_on_boot/tasks/main.yml b/ansible/roles/enable_iommu_on_boot/tasks/main.yml
index 188b32915..2772a5d52 100644
--- a/ansible/roles/enable_iommu_on_boot/tasks/main.yml
+++ b/ansible/roles/enable_iommu_on_boot/tasks/main.yml
@@ -54,25 +54,26 @@
- not is_nsb_iommu_role.changed
- is_iommu.changed
- - name: Add IOMMU when it is not set
- lineinfile:
- path: "{{ grub_file }}"
- regexp: "{{ iommu_help_string }}"
- line: '{{ enable_iommu }}" {{ iommu_help_string }}'
+ - block:
+ - name: Add IOMMU when it is not set
+ lineinfile:
+ path: "{{ grub_file }}"
+ regexp: "{{ iommu_help_string }}"
+ line: '{{ enable_iommu }}" {{ iommu_help_string }}'
+
+ - name: find boot grub.cfg
+ find:
+ paths: /boot
+ file_type: file
+ patterns: 'grub*.cfg'
+ recurse: yes
+ register: grub_files
+
+ - include: manual_modify_grub.yml
+ # only tested on Ubuntu, kernel line is probably different on other distros
+ with_items: "{{ grub_files.files }}"
when:
+ - ansible_distribution == "Ubuntu"
- not is_nsb_iommu_role.changed
- not is_iommu.changed
-
- - name: find boot grub.cfg
- find:
- paths: /boot
- file_type: file
- patterns: 'grub*.cfg'
- recurse: yes
- register: grub_files
-
- - include: manual_modify_grub.yml
- # only tested on Ubuntu, kernel line is probably different on other distros
- with_items: "{{ grub_files.files }}"
- when: ansible_distribution == "Ubuntu"
when: iommu_boot_params is defined
diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml
index 42951bf6d..558e68a9b 100644
--- a/ansible/roles/install_image_dependencies/defaults/main.yml
+++ b/ansible/roles/install_image_dependencies/defaults/main.yml
@@ -30,6 +30,7 @@ install_dependencies:
- libxss-dev
- expect
- libnuma-dev
+ - curl
RedHat:
- bc
- fio
@@ -50,3 +51,4 @@ install_dependencies:
- sysstat
- unzip
- python-devel
+ - curl