aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-09-10 08:09:43 +0000
committerPeter Mikus <pmikus@cisco.com>2019-09-11 10:54:32 +0000
commit891f932d2c0928038c7cb77f96ecad6e12c0e81f (patch)
tree706a3867e582b0a1f0b1436c94a6da4e1eb7f315 /resources/tools/testbed-setup/ansible
parent27cff25483728d50e0215b895c680fb88f6ffe99 (diff)
Ansible: Trex installation
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I5ab8fe05074a842301a511bbd3ab5e67f8d1a9f0
Diffstat (limited to 'resources/tools/testbed-setup/ansible')
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml13
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml2
-rw-r--r--resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml24
-rw-r--r--resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml1
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml5
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml40
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml1
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml12
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml3
-rw-r--r--resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml17
12 files changed, 94 insertions, 28 deletions
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
index 40d7544476..062f3af10e 100644
--- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml
@@ -37,10 +37,15 @@ docker_daemon_environment_https:
- 'NO_PROXY={{ proxy_env.no_proxy }}'
# Kubernetes settings.
-kubernetes_channel: 'main'
-kubernetes_version: '1.11.0-00'
-kubernetes_repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_channel }}'
-kubernetes_apt_package_name: '{{ kubernetes_version }}'
+kubernetes:
+ version: '1.11.0-00'
+ repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial main'
+
+# TRex settings.
+trex:
+ target_dir: '/opt'
+ version: '2.61'
+ url: 'https://github.com/cisco-system-traffic-generator/trex-core/archive'
# DPDK settings.
dpdk:
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml
index 27beaf5225..0f4effa650 100644
--- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml
@@ -10,7 +10,7 @@ sysctl:
kernel:
watchdog_cpumask: "0,28,56,84"
vm:
- nr_hugepages: 36864
+ nr_hugepages: 65536
max_map_count: 20000
inventory_ipmi_hostname: '10.30.50.41'
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml
index e462460b23..9564e45fc9 100644
--- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml
@@ -10,7 +10,7 @@ sysctl:
kernel:
watchdog_cpumask: "0,28,56,84"
vm:
- nr_hugepages: 36864
+ nr_hugepages: 65536
max_map_count: 20000
inventory_ipmi_hostname: '10.30.50.51'
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml
index b5131a310a..1458017f50 100644
--- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml
+++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml
@@ -10,7 +10,7 @@ sysctl:
kernel:
watchdog_cpumask: "0,28,56,84"
vm:
- nr_hugepages: 36864
+ nr_hugepages: 65536
max_map_count: 20000
inventory_ipmi_hostname: '10.30.50.53'
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml
index 5f8a0590bf..4f7800b249 100644
--- a/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml
@@ -1,7 +1,7 @@
---
# file: roles/common/tasks/kernel_install.yaml
-- name: Kernel VM: Backup remote initramfs modules
+- name: Kernel VM - Backup remote initramfs modules
copy:
src: '/etc/initramfs-tools/modules'
dest: '/tmp/initramfs_modules.bkp'
@@ -10,7 +10,7 @@
register: __initramfs_modules_backuped
tags: install-kernel-image
-- name: Kernel VM: Backup remote initramfs resume config
+- name: Kernel VM - Backup remote initramfs resume config
copy:
src: '/etc/initramfs-tools/conf.d/resume'
dest: '/tmp/initramfs-resume.bkp'
@@ -19,59 +19,61 @@
register: __initramfs_resume_backuped
tags: install-kernel-image
-- name: Kernel VM: Update remote initramfs modules
+- name: Kernel VM - Update remote initramfs modules
copy:
src: '../files/initramfs_modules'
dest: '/etc/initramfs-tools/modules'
tags: install-kernel-image
-- name: Kernel VM: Update remote initramfs resume config
+- name: Kernel VM - Update remote initramfs resume config
copy:
src: '../files/initramfs_resume'
dest: '/etc/initramfs-tools/conf.d/resume'
tags: install-kernel-image
-- name: Kernel VM: Create target kernel dir
+- name: Kernel VM - Create target kernel dir
file:
path: '/opt/boot'
state: 'directory'
tags: install-kernel-image
-- name: Kernel VM: Build initrd image
+- name: Kernel VM - Build initrd image
shell: 'update-initramfs -k {{ ansible_kernel }} -c -b /opt/boot'
tags: install-kernel-image
-- name: Kernel VM: Copy corresponding kernel img
+- name: Kernel VM - Copy corresponding kernel img
copy:
src: '/boot/vmlinuz-{{ ansible_kernel }}'
dest: '/opt/boot/vmlinuz-{{ ansible_kernel }}'
remote_src: yes
tags: install-kernel-image
-- name: Kernel VM: Restore remote initramfs modules
+- name: Kernel VM - Restore remote initramfs modules
copy:
src: '/tmp/initramfs_modules.bkp'
dest: '/etc/initramfs-tools/modules'
remote_src: yes
+ ignore_errors: yes
when: __initramfs_modules_backuped
tags: install-kernel-image
-- name: Kernel VM: Remove remote backup initramfs modules
+- name: Kernel VM - Remove remote backup initramfs modules
file:
path: '/tmp/initramfs_modules.bkp'
state: 'absent'
when: __initramfs_modules_backuped
tags: install-kernel-image
-- name: Kernel VM: Restore remote initramfs resume config
+- name: Kernel VM - Restore remote initramfs resume config
copy:
src: '/tmp/initramfs-resume.bkp'
dest: '/etc/initramfs-tools/conf.d/resume'
remote_src: yes
+ ignore_errors: yes
when: __initramfs_resume_backuped
tags: install-kernel-image
-- name: Kernel VM: Remove remote backup initramfs resume config
+- name: Kernel VM - Remove remote backup initramfs resume config
file:
path: '/tmp/initramfs-resume.bkp'
state: 'absent'
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
index 96e3f83e1b..fb0d77d18c 100644
--- a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml
@@ -56,6 +56,7 @@
- name: Install distribution - release - machine prerequisites
include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
+ tags: [ install-csit-dependencies, copy-apt-sources ]
- name: Set sudoers admin
lineinfile:
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
index 24f433f9b9..0b32002545 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml
@@ -3,7 +3,12 @@
- name: Install distribution - release - machine prerequisites
include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
+ tags: install-csit-dependencies
- name: Install WRK
include_tasks: 'wrk.yaml'
tags: install-wrk
+
+- name: Install TRex
+ include_tasks: 'trex.yaml'
+ tags: install-trex
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml
new file mode 100644
index 0000000000..3cfcbea825
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml
@@ -0,0 +1,40 @@
+---
+# file: roles/tg/tasks/trex.yaml
+
+- name: Download TRex release archive
+ get_url:
+ url: '{{ trex.url }}/v{{ trex.version }}.tar.gz'
+ dest: '{{ trex.target_dir }}/trex-core-{{ trex.version }}.tar.gz'
+ mode: 0644
+ register: 'linux__trex_downloaded'
+ tags: install-trex
+
+- name: Ensure TRex directory exists
+ file:
+ path: '{{ trex.target_dir }}/trex-core-{{ trex.version }}'
+ state: 'directory'
+ register: 'linux__trex_dir_created'
+ tags: install-trex
+
+- name: Extract TRex release archive
+ become: yes
+ unarchive:
+ src: '{{ trex.target_dir }}/trex-core-{{ trex.version }}.tar.gz'
+ dest: '{{ trex.target_dir }}/'
+ creates: '{{ trex.target_dir }}/trex-core-{{ trex.version }}/linux_dpdk'
+ remote_src: yes
+ when: 'linux__trex_dir_created'
+ register: 'linux__trex_extracted'
+ tags: install-trex
+
+- name: Compile TRex release I
+ become: yes
+ shell: 'cd {{ trex.target_dir }}/trex-core-{{ trex.version }}/linux_dpdk/; ./b configure; ./b build'
+ when: 'linux__trex_extracted'
+ tags: install-trex
+
+- name: Compile TRex release II
+ become: yes
+ shell: 'cd {{ trex.target_dir }}/trex-core-{{ trex.version }}/scripts/ko/src; make; make install'
+ when: 'linux__trex_extracted'
+ tags: install-trex
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
index 95a47b0917..d56c843158 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml
@@ -5,6 +5,7 @@
apt:
name:
- 'unzip'
+ - 'zlib1g-dev'
- 'libssl-dev'
state: 'present'
install_recommends: False
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
index 1da45fb4b4..e7d22e1aa1 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml
@@ -9,13 +9,21 @@
register: 'linux__wrk_downloaded'
tags: install-wrk
+- name: Ensure WRK directory exists
+ file:
+ path: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
+ state: 'directory'
+ register: 'linux__wrk_dir_created'
+ tags: install-wrk
+
- name: Extract WRK release archive
become: yes
unarchive:
src: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz'
- dest: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}'
+ dest: '{{ wrk.target_dir }}/'
+ creates: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}/src'
remote_src: yes
- when: 'linux__wrk_downloaded'
+ when: 'linux__wrk_dir_created'
register: 'linux__wrk_extracted'
tags: install-wrk
diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml
index f586e871c7..7f74beec51 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml
@@ -3,13 +3,16 @@
- name: Install distribution - release - machine prerequisites
include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml'
+ tags: [ install-csit-dependencies, install-docker, install-kubernetes ]
- name: Machine specifics
include_tasks: '{{ ansible_machine }}.yaml'
+ tags: [ disable-turbo-boost, set-grub, install-pip ]
- name: Skylake specific
import_tasks: skylake.yaml
when: cpu_microarchitecture == "skylake"
+ tags: [ install-msr, disable-turbo-boost ]
- name: Copy netplan network config file
template:
diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml
index 67c6c17220..6e8dee6cf1 100644
--- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml
@@ -45,6 +45,7 @@
file:
path: '/etc/systemd/system/docker.service.d'
state: 'directory'
+ tags: install-docker
- name: Setup Docker http proxy
template:
@@ -55,7 +56,7 @@
mode: '0644'
register: docker_register_systemd_service
when: proxy_env is defined and proxy_env.http_proxy is defined
- tags: copy-docker
+ tags: install-docker
- name: Setup Docker https proxy
template:
@@ -66,14 +67,14 @@
mode: '0644'
register: docker_register_systemd_service
when: proxy_env is defined and proxy_env.https_proxy is defined
- tags: copy-docker
+ tags: install-docker
- name: Reload systemd daemon
command: 'systemctl daemon-reload'
notify: ['Restart Docker']
when: (docker_register_systemd_service and
docker_register_systemd_service is changed)
- tags: restart-docker
+ tags: install-docker
- name: Set specific users to docker group
user:
@@ -82,7 +83,7 @@
append: True
with_items: '{{ docker_users }}'
when: docker_users
- tags: set-docker
+ tags: install-docker
- name: Add an Apt signing key, for Kubernetes repository
apt_key:
@@ -92,7 +93,7 @@
- name: Install kubernetes APT repository
apt_repository:
- repo: '{{ kubernetes_repository }}'
+ repo: '{{ kubernetes.repository }}'
state: 'present'
update_cache: True
tags: install-kubernetes
@@ -101,9 +102,9 @@
apt:
name:
- 'kubernetes-cni=0.6.0-00'
- - 'kubeadm={{ kubernetes_apt_package_name }}'
- - 'kubectl={{ kubernetes_apt_package_name }}'
- - 'kubelet={{ kubernetes_apt_package_name }}'
+ - 'kubeadm={{ kubernetes.version }}'
+ - 'kubectl={{ kubernetes.version }}'
+ - 'kubelet={{ kubernetes.version }}'
state: 'present'
force: yes
tags: install-kubernetes