--- /dev/null
+---
+# file: roles/common/tasks/main.yaml
+
+- name: Conf - Add permanent proxy settings
+ lineinfile:
+ path: "/etc/environment"
+ state: "present"
+ line: "{{ item.key }}={{ item.value }}"
+ with_dict: "{{ proxy_env }}"
+ when: proxy_env is defined
+ tags:
+ - common-conf-proxy
+
+- name: Inst - Update package cache (apt)
+ apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ when:
+ - ansible_distribution|lower == 'ubuntu'
+ tags:
+ - common-inst-prerequisites
+
+- name: Inst - Prerequisites
+ package:
+ name: "{{ packages | flatten(levels=1) }}"
+ state: latest
+ tags:
+ - common-inst-prerequisites
+
+- name: Inst - Meson (DPDK)
+ pip:
+ name:
+ - "meson==0.47.1"
+ tags:
+ - common-inst-meson
+
+- name: Conf - sudoers admin
+ lineinfile:
+ path: "/etc/sudoers"
+ state: "present"
+ regexp: "^%admin ALL="
+ line: "%admin ALL=(ALL) ALL"
+ validate: "/usr/sbin/visudo -cf %s"
+ tags:
+ - common-conf-sudoers
+
+- name: Conf - sudoers nopasswd
+ lineinfile:
+ path: "/etc/sudoers"
+ state: "present"
+ regexp: "^%sudo"
+ line: "%sudo ALL=(ALL:ALL) NOPASSWD: ALL"
+ validate: "/usr/sbin/visudo -cf %s"
+ tags:
+ - common-conf-sudoers
--- /dev/null
+---
+# file: roles/common/defaults/main.yaml
+
+packages: "{{ packages_base + packages_by_distro[ansible_distribution|lower][ansible_distribution_release] + packages_by_arch[ansible_machine] }}"
+
+packages_base:
+ - "virtualenv"
+
+packages_by_distro:
+ ubuntu:
+ bionic:
+ - "python-all"
+ - "python-apt"
+ - "python-cffi"
+ - "python-cffi-backend"
+ - "python-dev"
+ - "python-pip"
+ - "python-setuptools"
+ - "python3-all"
+ - "python3-apt"
+ - "python3-cffi"
+ - "python3-cffi-backend"
+ - "python3-dev"
+ - "python3-pip"
+ - "python3-pyelftools"
+ - "python3-setuptools"
+ focal:
+ - "python3-all"
+ - "python3-apt"
+ - "python3-cffi"
+ - "python3-cffi-backend"
+ - "python3-dev"
+ - "python3-pip"
+ - "python3-pyelftools"
+ - "python3-setuptools"
+
+packages_by_arch:
+ aarch64:
+ - []
+ x86_64:
+ - []
\ No newline at end of file
---
-# file: roles/common/tasks/main.yaml
-
-- name: Conf - Add permanent proxy settings
- lineinfile:
- path: "/etc/environment"
- state: "present"
- line: "{{ item.key }}={{ item.value }}"
- with_dict: "{{ proxy_env }}"
- when: proxy_env is defined
- tags:
- - common-conf-proxy
+# file: roles/python_env/tasks/main.yaml
- name: Inst - Update package cache (apt)
apt:
- "scapy==2.4.3"
- "scp==0.13.2"
- "ansible==2.10.7"
- - "dill==0.2.8.2"
+ - "dill==0.3.3"
- "numpy==1.17.3"
- "hdrhistogram==0.6.1"
- "plotly==4.1.1"
- "scipy==1.5.4"
tags:
- common-inst-pip
-
-- name: Inst - Meson (DPDK)
- pip:
- name:
- - "meson==0.47.1"
- tags:
- - common-inst-meson
-
-- name: Conf - sudoers admin
- lineinfile:
- path: "/etc/sudoers"
- state: "present"
- regexp: "^%admin ALL="
- line: "%admin ALL=(ALL) ALL"
- validate: "/usr/sbin/visudo -cf %s"
- tags:
- - common-conf-sudoers
-
-- name: Conf - sudoers nopasswd
- lineinfile:
- path: "/etc/sudoers"
- state: "present"
- regexp: "^%sudo"
- line: "%sudo ALL=(ALL:ALL) NOPASSWD: ALL"
- validate: "/usr/sbin/visudo -cf %s"
- tags:
- - common-conf-sudoers
-
-- meta: flush_handlers
#!/usr/bin/env bash
-# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
# 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:
#!/usr/bin/env bash
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
# 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:
#!/usr/bin/env bash
-# Copyright (c) 2019 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
# 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:
tags: baremetal
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: kernel
tags: kernel
- role: mellanox
tags: user_add
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: vpp
tags: vpp
- role: dpdk
tags: user_add
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: docker
tags: docker
- role: vpp
tags: azure
- role: cleanup
tags: cleanup
- # TODO: 'Check Kernel Parameters' failing in
- # resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml
- # - role: calibration
- # tags: calibration
+ - role: calibration
+ tags: calibration
tags: baremetal
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: kernel
tags: kernel
- role: mellanox
tags: user_add
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: dpdk
tags: dpdk
- role: docker
tags: user_add
- role: common
tags: common
+ - role: python_env
+ tags: python_env
- role: docker
tags: docker
- role: tg
tags: azure
- role: cleanup
tags: cleanup
- # TODO: 'Check Kernel Parameters' failing in
- # resources/tools/testbed-setup/ansible/roles/calibration/tasks/main.yaml
- # - role: calibration
- # tags: calibration
\ No newline at end of file
+ - role: calibration
+ tags: calibration
\ No newline at end of file
variable "ansible_file_path" {
description = "Path to Ansible playbook"
type = string
- default = "../../resources/tools/testbed-setup/ansible/site.yaml"
+ default = "../../fdio.infra.ansible/site.yaml"
}
variable "ansible_python_executable" {
variable "ansible_topology_path" {
description = "Path to Ansible playbook which creates a topology file"
type = string
- default = "../../resources/tools/testbed-setup/ansible/cloud_topology.yaml"
+ default = "../../fdio.infra.ansible/cloud_topology.yaml"
}
variable "ansible_provision_pwd" {
# Ansible
ansible_python_executable = "/usr/bin/python3"
- ansible_file_path = "../../resources/tools/testbed-setup/ansible/site.yaml"
- ansible_topology_path = "../../resources/tools/testbed-setup/ansible/cloud_topology.yaml"
+ ansible_file_path = "../../fdio.infra.ansible/site.yaml"
+ ansible_topology_path = "../../fdio.infra.ansible/cloud_topology.yaml"
ansible_provision_pwd = "Csit1234"
# First run
variable "ansible_file_path" {
description = "Path to Ansible playbook"
type = string
- default = "../../resources/tools/testbed-setup/ansible/site.yaml"
+ default = "../../fdio.infra.ansible/site.yaml"
}
variable "ansible_python_executable" {
variable "ansible_topology_path" {
description = "Path to Ansible playbook which creates a topology file"
type = string
- default = "../../resources/tools/testbed-setup/ansible/cloud_topology.yaml"
+ default = "../../fdio.infra.ansible/cloud_topology.yaml"
}
variable "ansible_provision_pwd" {
# Ansible
ansible_python_executable = "/usr/bin/python3"
- ansible_file_path = "../../resources/tools/testbed-setup/ansible/site.yaml"
- ansible_topology_path = "../../resources/tools/testbed-setup/ansible/cloud_topology.yaml"
+ ansible_file_path = "../../fdio.infra.ansible/site.yaml"
+ ansible_topology_path = "../../fdio.infra.ansible/cloud_topology.yaml"
ansible_provision_pwd = "Csit1234"
# First run
ansible==2.10.7
# PLRsearch dependencies
-dill==0.2.8.2
+dill==0.3.3
numpy==1.17.3
scipy==1.5.4
#
# Variable read:
# - ${WORKING_TOPOLOGY} - Reserved working topology.
- # - ${TOOLS_DIR} - CSIT tools directory, where testbed-setup is located.
+ # - ${CSIT_DIR} - CSIT main directory, where ansible playbooks are located.
set -exuo pipefail
hosts=($(fgrep host "${WORKING_TOPOLOGY}" | cut -d ":" -f 2)) || {
die "Failed to read hosts from working topology!"
}
- pushd "${TOOLS_DIR}"/testbed-setup/ansible || die "Pushd failed!"
+ pushd "${CSIT_DIR}"/fdio.infra.ansible || die "Pushd failed!"
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_STDOUT_CALLBACK=yaml
export ANSIBLE_PIPELINING=true
#
# Variable read:
# - ${WORKING_TOPOLOGY} - Reserved working topology.
- # - ${TOOLS_DIR} - CSIT tools directory, where testbed-setup is located.
+ # - ${CSIT_DIR} - CSIT main directory, where ansible playbooks are located.
set -exuo pipefail
hosts=($(fgrep host "${WORKING_TOPOLOGY}" | cut -d ":" -f 2)) || {
die "Failed to read hosts from working topology!"
}
- pushd "${TOOLS_DIR}"/testbed-setup/ansible || die "Pushd failed!"
+ pushd "${CSIT_DIR}"/fdio.infra.ansible || die "Pushd failed!"
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_STDOUT_CALLBACK=yaml
export ANSIBLE_PIPELINING=true
+++ /dev/null
-Testbed Setup
-=============
-
-Introduction
-------------
-
-This directory contains the *high-level* process to set up a hardware machine
-as a CSIT testbed, either for use as a physical performance testbed host or as
-a vpp_device host.
-
-Code in this directory is NOT executed as part of a regular CSIT test case
-but is stored here for ad-hoc installation of HW, archiving and documentation
-purposes.
-
-Documentation below is step by step tutorial and assumes an understanding of PXE
-boot and `Ansible <https://www.ansible.com/>`_ and managing physical hardware
-via CIMC or IPMI.
-
-This process is not specific for Linux Foundation lab, but associated files and
-code, is based on the assumption that it runs in Linux Foundation environment.
-If run elsewhere, changes will be required in following files:
-
-#. Inventory directory: `ansible/inventories/sample_inventory/`
-#. Inventory files: `ansible/inventories/sample_inventory/hosts`
-
-The process below assumes that there is a host used for bootstrapping (referred
-to as a "Cobbler provision host" below), with reachable DHCP service.
-
-Ansible host
-------------
-
-Prerequisities for running Ansible
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-- CIMC/IPMI address, username, password are set in BIOS.
-- Ansible can be invoked on any host that has direct SSH connectivity to
- the remote hosts that will be provisioned (does not need to be Cobbler
- provision host). This may require installed ssh_keys `ssh-copy-id` on remote
- host or disabled StrictHostChecking on host running Ansible:
-
- ::
-
- Host <host_ip or host subnet_ip>
- StrictHostKeyChecking no
- UserKnownHostsFile=/dev/null
-
-- Ansible version 2.7+ is installed via PIP or via standard package
- distribution (apt, yum, dnf).
-- User `testuser` with password `Csit1234` is created with home folder
- initialized on all remote machines that will be provisioned.
-- Inventory directory is created with same or similar content as
- `inventories/lf_inventory` in `inventories/` directory (`sample_inventory`
- can be used).
-- Group variables in `ansible/inventories/<inventory>/group_vars/all.yaml` are
- adjusted per environment with special attention to `proxy_env` variable.
-- Host variables in `ansible/inventories/<inventory>/host_vars/x.x.x.x.yaml` are
- defined.
-
-Ansible structure
-~~~~~~~~~~~~~~~~~
-
-Ansible is defining roles `tg` (Traffic Generator), `sut` (System Under Test),
-`vpp_device` (vpp_device host for functional device testing), `common`
-(Applicable for all hosts in inventory) and `cobbler` (Cobbler provision host).
-
-Each host has corresponding Ansible role mapped and is applied only if a host
-with that role is present in inventory file. As a part of optimization the role
-`common` contains Ansible tasks applied for all hosts.
-
-.. note::
-
- You may see `[WARNING]: Could not match supplied host pattern, ignoring:
- <role>` in case you have not define hosts for that particular role.
-
-Ansible structure is described below:
-
-.. code-block:: bash
-
- .
- ├── inventories # Contains all inventories.
- │ ├── sample_inventory # Sample, free for edits outside of LF.
- │ │ ├── group_vars # Variables applied for all hosts.
- │ │ │ └── all.yaml
- │ │ ├── hosts # Inventory list with sample hosts.
- │ │ └── host_vars # Variables applied for single host only.
- │ │ └── 1.1.1.1.yaml # Sample host with IP 1.1.1.1
- │ └── lf_inventory # Linux Foundation inventory.
- │ ├── group_vars
- │ │ └── all.yaml
- │ ├── hosts
- │ └── host_vars
- ├── roles # CSIT roles.
- │ ├── cobbler # Role applied for Cobbler host only.
- │ ├── common # Role applied for all hosts.
- │ ├── sut # Role applied for all SUTs only.
- │ ├── tg # Role applied for all TGs only.
- │ ├── tg_sut # Role applied for TGs and SUTs only.
- │ └── vpp_device # Role applied for vpp_device only.
- ├── site.yaml # Main playbook.
- ├── sut.yaml # SUT playbook.
- ├── tg.yaml # TG playbook.
- ├── vault_pass # Main password for vault.
- ├── vault.yml # Ansible vault storage.
- └── vpp_device.yaml # vpp_device playbook.
-
-Tagging
-~~~~~~~
-
-Every task, handler, role or playbook is tagged with self-explanatory tag(s)
-that could be used to limit which Ansible objects are applied to target systems.
-
-You can see what tags are applied to tasks, roles, and static imports by
-running `ansible-playbook` with the `--list-tasks` option. You can display all
-tags applied to the tasks with the `--list-tags` option.
-
-Running Ansible
-~~~~~~~~~~~~~~~
-
-#. Go to ansible directory: `$ cd csit/resources/tools/testbed-setup/ansible`
-#. Run ansible on selected hosts:
- `$ ansible-playbook --vault-password-file=vault_pass --extra-vars
- '@vault.yml' --inventory <inventory_file> site.yaml --limit <host_ip>`
-#. (Optional) Run ansible on selected hosts with selected tags:
- `$ ansible-playbook --vault-password-file=vault_pass --extra-vars
- '@vault.yml' --inventory <inventory_file> site.yaml --limit <host_ip>
- --tags 'copy-90-csit'`
-
-.. note::
-
- In case you want to provision only particular role. You can use tags: `tg`,
- `sut`, `vpp_device`.
-
-Baremetal provisioning of host via Ansible Cobbler module
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Baremetal provisioning of the host with Ansible is done via `Cobbler
-<https://cobbler.github.io/>`_. Ansible contains a role `cobbler` that includes
-a set of tasks for deploying Cobbler in a container on dedicated host.
-Container is built during Ansible run of `cobbler` role and it provides DHCPD,
-TFTPD, HTTTP and Cobbler services.
-
-There is a special set of tasks and handlers in `common` role that does include
-a system into Cobbler and reboots provisioned host.
-
-#. Go to Ansible directory: `$ cd csit/resources/tools/testbed-setup/ansible`
-#. Prepare Cobbler provision host via Ansible on dedicated hosts:
- `$ ansible-playbook --vault-password-file=vault_pass --extra-vars
- '@vault.yml' --inventory <inventory_file> site.yaml --limit <cobbler_ip>`
-#. Run Ansible on selected hosts with selected tags:
- `$ ansible-playbook --vault-password-file=vault_pass --extra-vars
- '@vault.yml' --inventory <inventory_file> site.yaml --limit <host_ip>
- --tags 'provision'`
+++ /dev/null
-# If you change this file, run 'update-grub' afterwards to update
-# /boot/grub/grub.cfg.
-# For full documentation of the options in this file, see:
-# info -f grub -n 'Simple configuration'
-
-GRUB_DEFAULT=0
-GRUB_TIMEOUT=10
-GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
-GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0,115200n8"
-GRUB_CMDLINE_LINUX=""
-
-# Uncomment to enable BadRAM filtering, modify to suit your needs
-# This works with Linux (no patch required) and with any kernel that obtains
-# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
-#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
-
-# Uncomment to disable graphical terminal (grub-pc only)
-#GRUB_TERMINAL=console
-GRUB_TERMINAL=serial
-GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
-
-# The resolution used on graphical terminal
-# note that you can use only modes which your graphic card supports via VBE
-# you can see them in real GRUB with the command `vbeinfo'
-#GRUB_GFXMODE=640x480
-
-# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
-#GRUB_DISABLE_LINUX_UUID=true
-
-# Uncomment to disable generation of recovery mode menu entries
-#GRUB_DISABLE_RECOVERY="true"
-
-# Uncomment to get a beep at grub start
-#GRUB_INIT_TUNE="480 440 1"
+++ /dev/null
-# If you change this file, run 'update-grub' afterwards to update
-# /boot/grub/grub.cfg.
-# For full documentation of the options in this file, see:
-# info -f grub -n 'Simple configuration'
-
-GRUB_DEFAULT=0
-GRUB_TIMEOUT=10
-GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
-GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
-GRUB_CMDLINE_LINUX=""
-
-# Uncomment to enable BadRAM filtering, modify to suit your needs
-# This works with Linux (no patch required) and with any kernel that obtains
-# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
-#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
-
-# Uncomment to disable graphical terminal (grub-pc only)
-#GRUB_TERMINAL=console
-GRUB_TERMINAL=serial
-GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
-
-# The resolution used on graphical terminal
-# note that you can use only modes which your graphic card supports via VBE
-# you can see them in real GRUB with the command `vbeinfo'
-#GRUB_GFXMODE=640x480
-
-# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
-#GRUB_DISABLE_LINUX_UUID=true
-
-# Uncomment to disable generation of recovery mode menu entries
-#GRUB_DISABLE_RECOVERY="true"
-
-# Uncomment to get a beep at grub start
-#GRUB_INIT_TUNE="480 440 1"