diff options
26 files changed, 216 insertions, 145 deletions
diff --git a/resources/tools/testbed-setup/ansible/cobbler.yaml b/resources/tools/testbed-setup/ansible/cobbler.yaml index 06e6238e18..a738fd2d65 100644 --- a/resources/tools/testbed-setup/ansible/cobbler.yaml +++ b/resources/tools/testbed-setup/ansible/cobbler.yaml @@ -8,3 +8,5 @@ roles: - role: cobbler tags: cobbler + - role: docker + tags: docker 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 68994ec36b..f53584a939 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 @@ -22,25 +22,6 @@ name_servers: "1.1.1.1, 8.8.8.8" # no_proxy: localhost,127.0.0.1,{{ ansible_default_ipv4.address }} # NO_PROXY: localhost,127.0.0.1,{{ ansible_default_ipv4.address }} -# Docker settings. -docker_edition: 'ce' -docker_channel: 'edge' -docker_version: '18.05.0' -docker_users: ['testuser'] -docker_repository: 'deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}' -docker_apt_package_name: '{{ docker_version }}~{{ docker_edition }}~3-0~{{ ansible_distribution | lower }}' -docker_daemon_environment_http: - - 'HTTP_PROXY={{ proxy_env.http_proxy }}' - - 'NO_PROXY={{ proxy_env.no_proxy }}' -docker_daemon_environment_https: - - 'HTTPS_PROXY={{ proxy_env.https_proxy }}' - - 'NO_PROXY={{ proxy_env.no_proxy }}' - -# Kubernetes settings. -kubernetes: - version: '1.11.0-00' - repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial main' - # TRex settings. trex: target_dir: '/opt' diff --git a/resources/tools/testbed-setup/ansible/roles/docker/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/docker/defaults/main.yaml new file mode 100644 index 0000000000..30958c9fa4 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/docker/defaults/main.yaml @@ -0,0 +1,27 @@ +# Version options. +docker_edition: 'ce' +docker_version: '19.03.3' +docker_apt_package: '5:{{ docker_version }}~3-0~{{ ansible_distribution | lower }}-{{ ansible_distribution_release }}' +docker_apt_package_state: present + +# Service options. +docker_service_state: started +docker_service_enabled: true +docker_restart_handler_state: restarted + +# Used only for Debian/Ubuntu. Switch 'stable' to 'edge' if needed. +docker_apt_release_channel: 'edge' +docker_apt_repository: 'deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}' +docker_apt_repository_state: present + +# A list of users who will be added to the docker group. +docker_users: + - 'testuser' + +# Proxy settings. +docker_daemon_environment_http: + - 'HTTP_PROXY={{ proxy_env.http_proxy }}' + - 'NO_PROXY={{ proxy_env.no_proxy }}' +docker_daemon_environment_https: + - 'HTTPS_PROXY={{ proxy_env.https_proxy }}' + - 'NO_PROXY={{ proxy_env.no_proxy }}' diff --git a/resources/tools/testbed-setup/ansible/roles/docker/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/docker/handlers/main.yaml new file mode 100644 index 0000000000..d33c63fae8 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/docker/handlers/main.yaml @@ -0,0 +1,8 @@ +--- +# file roles/docker/handlers/main.yaml + +- name: Restart Docker + service: + name: 'docker' + state: '{{ docker_restart_handler_state }}' + tags: restart-docker diff --git a/resources/tools/testbed-setup/ansible/roles/docker/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/docker/tasks/main.yaml new file mode 100644 index 0000000000..368ddf5d1a --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/docker/tasks/main.yaml @@ -0,0 +1,54 @@ +--- +# file: roles/docker/tasks/main.yaml + +- name: Docker - Install distribution - release - machine prerequisites + include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' + tags: install-docker + +- name: Docker - Create Service Directory + file: + path: '/etc/systemd/system/docker.service.d' + state: 'directory' + tags: install-docker + +- name: Docker - Setup HTTP Proxy + template: + src: 'templates/docker.service.proxy.http' + dest: '/etc/systemd/system/docker.service.d/http-proxy.conf' + owner: 'root' + group: 'root' + mode: '0644' + when: > + proxy_env is defined and + proxy_env.http_proxy is defined + tags: install-docker + +- name: Docker - Setup HTTPS Proxy + template: + src: 'templates/docker.service.proxy.https' + dest: '/etc/systemd/system/docker.service.d/https-proxy.conf' + owner: 'root' + group: 'root' + mode: '0644' + when: > + proxy_env is defined and + proxy_env.https_proxy is defined + tags: install-docker + +- name: Docker - Reload systemd daemon and restart service + command: 'systemctl daemon-reload' + notify: + - 'Restart Docker' + when: > + proxy_env is defined and + proxy_env.http_proxy is defined + tags: install-docker + +- name: Docker - Set specific users to docker group + user: + name: '{{ item }}' + groups: 'docker' + append: True + with_items: '{{ docker_users }}' + when: docker_users + tags: install-docker diff --git a/resources/tools/testbed-setup/ansible/roles/docker/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/docker/tasks/ubuntu_bionic.yaml new file mode 100644 index 0000000000..32643b1119 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/docker/tasks/ubuntu_bionic.yaml @@ -0,0 +1,33 @@ +--- +# file: roles/docker/tasks/ubuntu_bionic.yaml + +- name: Docker repository - Dependencies + apt: + name: + - 'apt-transport-https' + - 'ca-certificates' + - 'software-properties-common' + state: 'present' + cache_valid_time: 3600 + install_recommends: False + tags: install-docker + +- name: Docker repository - Add an Apt signing key + apt_key: + url: 'https://download.docker.com/linux/ubuntu/gpg' + state: 'present' + tags: install-docker + +- name: Docker repository - Install APT repository + apt_repository: + repo: '{{ docker_apt_repository }}' + state: '{{ docker_apt_repository_state }}' + update_cache: True + tags: install-docker + +- name: Install Docker + apt: + name: 'docker-{{ docker_edition }}={{ docker_apt_package }}' + state: '{{ docker_apt_package_state }}' + force: True + tags: install-docker diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.proxy.http b/resources/tools/testbed-setup/ansible/roles/docker/templates/docker.service.proxy.http index 73ceba3870..73ceba3870 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.proxy.http +++ b/resources/tools/testbed-setup/ansible/roles/docker/templates/docker.service.proxy.http diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.proxy.https b/resources/tools/testbed-setup/ansible/roles/docker/templates/docker.service.proxy.https index 1c2097eb9d..1c2097eb9d 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.proxy.https +++ b/resources/tools/testbed-setup/ansible/roles/docker/templates/docker.service.proxy.https diff --git a/resources/tools/testbed-setup/ansible/roles/kubernetes/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/kubernetes/defaults/main.yaml new file mode 100644 index 0000000000..ed936e5da5 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/kubernetes/defaults/main.yaml @@ -0,0 +1,12 @@ +# Version options. +kubernetes_version: '1.11.0-00' +kubernetes_apt_package_state: present + +# Service options. +kubernetes_service_state: started +kubernetes_service_enabled: true +kubernetes_restart_handler_state: restarted + +# APT options. +kubernetes_apt_repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial main' +kubernetes_apt_repository_state: present diff --git a/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/main.yaml new file mode 100644 index 0000000000..160ffb8c06 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +# file: roles/kubernetes/tasks/main.yaml + +- name: Kubernetes - Install distribution - release - machine prerequisites + include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' + tags: install-kubernetes + +- name: Kubernetes - Apply kubelet parameter + lineinfile: + path: '/etc/default/kubelet' + state: 'present' + regexp: '^KUBELET_EXTRA_ARGS=*' + line: 'KUBELET_EXTRA_ARGS=--feature-gates HugePages=false' + tags: install-kubernetes diff --git a/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/ubuntu_bionic.yaml new file mode 100644 index 0000000000..ddb885f6ee --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/kubernetes/tasks/ubuntu_bionic.yaml @@ -0,0 +1,37 @@ +--- +# file: roles/kubernetes/tasks/ubuntu_bionic.yaml + +- name: Kubernetes repository - Dependencies + apt: + name: + - 'apt-transport-https' + - 'ca-certificates' + - 'software-properties-common' + state: 'present' + cache_valid_time: 3600 + install_recommends: False + tags: install-kubernetes + +- name: Kubernetes repository - Add an Apt signing key + apt_key: + url: 'https://packages.cloud.google.com/apt/doc/apt-key.gpg' + state: 'present' + tags: install-kubernetes + +- name: Kubernetes repository - Install APT repository + apt_repository: + repo: '{{ kubernetes_apt_repository }}' + state: '{{ kubernetes_apt_repository_state }}' + update_cache: True + tags: install-kubernetes + +- name: Kubernetes - Install + apt: + name: + - 'kubernetes-cni=0.6.0-00' + - 'kubeadm={{ kubernetes_version }}' + - 'kubectl={{ kubernetes_version }}' + - 'kubelet={{ kubernetes_version }}' + state: '{{ kubernetes_apt_package_state }}' + force: True + tags: install-kubernetes diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/90-csit b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/90-csit index 0c9036e936..0c9036e936 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/90-csit +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/90-csit diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/cpufrequtils b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/cpufrequtils index 03070fefe1..03070fefe1 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/cpufrequtils +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/cpufrequtils diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/disable-turbo-boost.service index e04729de50..e04729de50 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/disable-turbo-boost.service diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/irqbalance b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance index 84fb5f17e2..84fb5f17e2 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/irqbalance +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml index 8fbcb29de0..ed758d8dfc 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/handlers/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml @@ -1,11 +1,5 @@ --- -# file roles/tg_sut/handlers/main.yaml - -- name: Restart Docker - service: - name: 'docker' - state: 'restarted' - tags: restart-docker +# file roles/performance_tuning/handlers/main.yaml - name: Reboot server reboot: diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/aarch64.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml index 433ccc0eb6..b5ff02a9ca 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/aarch64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml @@ -1,5 +1,5 @@ --- -# file: roles/tg_sut/tasks/aarch64.yaml +# file: roles/performance_tuning/tasks/aarch64.yaml - name: Configure {{ ansible_machine }} kernel parameters lineinfile: diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml index 41985a367c..348bccbb33 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml @@ -1,9 +1,9 @@ --- -# file: roles/tg_sut/tasks/main.yaml +# file: roles/performance_tuning/tasks/main.yaml - name: Install distribution - release - machine prerequisites include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' - tags: [ install-csit-dependencies, install-docker, install-kubernetes ] + tags: install-csit-dependencies - name: Machine specifics include_tasks: '{{ ansible_machine }}.yaml' diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/turbo_boost.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml index 2fa704cdb0..a4872091a5 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/turbo_boost.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml @@ -1,5 +1,5 @@ --- -# file: roles/tg_sut/tasks/turbo_boost.yaml +# file: roles/performance_tuning/tasks/turbo_boost.yaml - name: Turbo boost - Install msr-tools apt: diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml new file mode 100644 index 0000000000..62b64be469 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml @@ -0,0 +1,11 @@ +--- +# file: roles/performance_tuning/tasks/ubuntu_bionic.yaml + +- name: Install CSIT dependencies + apt: + name: + - 'cpufrequtils' + state: 'present' + cache_valid_time: 3600 + install_recommends: False + tags: install-csit-dependencies diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml index 5b705eacb8..7b66300bc4 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/x86_64.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml @@ -1,5 +1,5 @@ --- -# file: roles/tg_sut/tasks/x86_64.yaml +# file: roles/performance_tuning/tasks/x86_64.yaml - name: Configure {{ ansible_machine }} kernel parameters lineinfile: diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml index 087b97f121..c109695db0 100644 --- a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml +++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml @@ -4,7 +4,6 @@ - name: Install CSIT dependencies apt: name: - - 'cpufrequtils' - 'gdb' - 'libglib2.0-dev' - 'libmbedcrypto1' 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 deleted file mode 100644 index fed589c432..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml +++ /dev/null @@ -1,109 +0,0 @@ ---- -# file: roles/tg_sut/tasks/ubuntu_bionic.yaml - -- name: Install CSIT dependencies - apt: - name: - - 'apt-transport-https' - - 'ca-certificates' - - 'software-properties-common' - state: 'present' - cache_valid_time: 3600 - install_recommends: False - tags: install-csit-dependencies - -- name: Add an Apt signing key, for docker-ce repository - apt_key: - url: https://download.docker.com/linux/ubuntu/gpg - state: 'present' - tags: install-docker - -- name: Install Docker APT repository - apt_repository: - repo: '{{ docker_repository }}' - state: 'present' - update_cache: True - tags: install-docker - -- name: Install Docker - apt: - name: 'docker-{{ docker_edition }}={{ docker_apt_package_name }}' - state: 'present' - force: yes - tags: install-docker - -- name: Creates Docker service directory - file: - path: '/etc/systemd/system/docker.service.d' - state: 'directory' - tags: install-docker - -- name: Setup Docker http proxy - template: - src: 'templates/docker.service.proxy.http' - dest: '/etc/systemd/system/docker.service.d/http-proxy.conf' - owner: 'root' - group: 'root' - mode: '0644' - register: docker_register_systemd_service - when: proxy_env is defined and proxy_env.http_proxy is defined - tags: install-docker - -- name: Setup Docker https proxy - template: - src: 'templates/docker.service.proxy.https' - dest: '/etc/systemd/system/docker.service.d/https-proxy.conf' - owner: 'root' - group: 'root' - mode: '0644' - register: docker_register_systemd_service - when: proxy_env is defined and proxy_env.https_proxy is defined - 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: install-docker - -- name: Set specific users to docker group - user: - name: '{{ item }}' - groups: 'docker' - append: True - with_items: '{{ docker_users }}' - when: docker_users - tags: install-docker - -- name: Add an Apt signing key, for Kubernetes repository - apt_key: - url: https://packages.cloud.google.com/apt/doc/apt-key.gpg - state: 'present' - tags: install-kubernetes - -- name: Install kubernetes APT repository - apt_repository: - repo: '{{ kubernetes.repository }}' - state: 'present' - update_cache: True - tags: install-kubernetes - -- name: Install Kubernetes - apt: - name: - - 'kubernetes-cni=0.6.0-00' - - 'kubeadm={{ kubernetes.version }}' - - 'kubectl={{ kubernetes.version }}' - - 'kubelet={{ kubernetes.version }}' - state: 'present' - force: yes - tags: install-kubernetes - -- name: Apply kubelet parameter - lineinfile: - path: '/etc/default/kubelet' - state: 'present' - regexp: '^KUBELET_EXTRA_ARGS=*' - line: 'KUBELET_EXTRA_ARGS=--feature-gates HugePages=false' - tags: install-kubernetes diff --git a/resources/tools/testbed-setup/ansible/sut.yaml b/resources/tools/testbed-setup/ansible/sut.yaml index a8dbb38331..d93d0b07cf 100644 --- a/resources/tools/testbed-setup/ansible/sut.yaml +++ b/resources/tools/testbed-setup/ansible/sut.yaml @@ -10,7 +10,11 @@ tags: common - role: sut tags: sut - - role: tg_sut - tags: tg_sut + - role: docker + tags: docker + - role: kubernetes + tags: kubernetes + - role: performance_tuning + tags: performance_tuning - role: calibration tags: calibration diff --git a/resources/tools/testbed-setup/ansible/tg.yaml b/resources/tools/testbed-setup/ansible/tg.yaml index 16d2e0fd40..4b5106652b 100644 --- a/resources/tools/testbed-setup/ansible/tg.yaml +++ b/resources/tools/testbed-setup/ansible/tg.yaml @@ -10,7 +10,9 @@ tags: common - role: tg tags: tg - - role: tg_sut - tags: tg_sut + - role: docker + tags: docker + - role: performance_tuning + tags: performance_tuning - role: calibration tags: calibration diff --git a/resources/tools/testbed-setup/ansible/vpp_device.yaml b/resources/tools/testbed-setup/ansible/vpp_device.yaml index 3d4894136f..8353be03c2 100644 --- a/resources/tools/testbed-setup/ansible/vpp_device.yaml +++ b/resources/tools/testbed-setup/ansible/vpp_device.yaml @@ -8,5 +8,7 @@ roles: - role: common tags: common + - role: docker + tags: docker - role: vpp_device tags: vpp_device |