From 8605f3f406468f57bb9b2eac12a4421f65965300 Mon Sep 17 00:00:00 2001 From: vagrant Date: Tue, 4 Feb 2020 14:16:01 +0000 Subject: CSIT Azure integration + Terraform + Ansible Signed-off-by: Peter Mikus Change-Id: I353511c5ef39d8c8d43fedc61c8dbb30b4821e1b --- .../roles/performance_tuning/defaults/main.yaml | 23 ++++++ .../roles/performance_tuning/files/irqbalance | 6 -- .../roles/performance_tuning/handlers/main.yaml | 15 ++-- .../roles/performance_tuning/tasks/aarch64.yaml | 12 --- .../roles/performance_tuning/tasks/main.yaml | 96 ++++++++++++---------- .../performance_tuning/tasks/turbo_boost.yaml | 39 +++++---- .../performance_tuning/tasks/ubuntu_bionic.yaml | 11 --- .../roles/performance_tuning/tasks/x86_64.yaml | 13 --- 8 files changed, 104 insertions(+), 111 deletions(-) create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/defaults/main.yaml delete mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance delete mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml delete mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml delete mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml (limited to 'resources/tools/testbed-setup/ansible/roles/performance_tuning') diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/defaults/main.yaml new file mode 100644 index 0000000000..60c16a9915 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/defaults/main.yaml @@ -0,0 +1,23 @@ +--- +# file: roles/performance_tuning/defaults/main.yaml + +packages: "{{ packages_base + packages_by_distro[ansible_distribution | lower] + packages_by_arch[ansible_machine] }}" + +packages_base: + - "cpufrequtils" + +packages_by_distro: + ubuntu: + - [] + +packages_by_arch: + aarch64: + - [] + x86_64: + - [] + +grub_cmdline_linux: + aarch64: + - 'GRUB_CMDLINE_LINUX="isolcpus={{ grub.isolcpus }} nohz_full={{ grub.nohz_full }} rcu_nocbs={{ grub.rcu_nocbs }} intel_iommu=on nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1"' + x86_64: + - 'GRUB_CMDLINE_LINUX="isolcpus={{ grub.isolcpus }} nohz_full={{ grub.nohz_full }} rcu_nocbs={{ grub.rcu_nocbs }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"' diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance b/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance deleted file mode 100644 index 84fb5f17e2..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/files/irqbalance +++ /dev/null @@ -1,6 +0,0 @@ -#Configuration for the irqbalance daemon - -#Should irqbalance be enabled? -ENABLED="0" -#Balance the IRQs only once? -ONESHOT="0" diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml index ed758d8dfc..917856b7a0 100644 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/handlers/main.yaml @@ -4,13 +4,10 @@ - name: Reboot server reboot: reboot_timeout: 3600 - tags: reboot-server + tags: + - reboot-server -- name: Wait for server to restart - wait_for: - host: '{{ inventory_hostname }}' - search_regex: OpenSSH - port: 22 - delay: 60 - timeout: 3600 - tags: reboot-server +- name: Update GRUB + command: update-grub + tags: + - update-grub diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml deleted file mode 100644 index b5ff02a9ca..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# file: roles/performance_tuning/tasks/aarch64.yaml - -- name: Configure {{ ansible_machine }} kernel parameters - lineinfile: - path: '/etc/default/grub' - state: 'present' - regexp: '^GRUB_CMDLINE_LINUX=' - line: 'GRUB_CMDLINE_LINUX="isolcpus={{ grub.isolcpus }} nohz_full={{ grub.nohz_full }} rcu_nocbs={{ grub.rcu_nocbs }} intel_iommu=on nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1"' - notify: - - 'Update GRUB' - tags: set-grub diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml index 348bccbb33..77b2683124 100644 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml @@ -1,57 +1,69 @@ --- # 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 +- name: Performance Tuning - Install Distribution - Release - Machine Prerequisites + package: + name: "{{ packages | flatten(levels=1) }}" + state: latest + update_cache: true + tags: + - install-dependencies -- name: Machine specifics - include_tasks: '{{ ansible_machine }}.yaml' - tags: set-grub +- name: Performance Tuning - Configure {{ ansible_machine }} kernel parameters + lineinfile: + path: "/etc/default/grub" + state: "present" + regexp: "^GRUB_CMDLINE_LINUX=" + line: {{ grub_cmdline_linux[ansible_machine] }} + notify: + - "Update GRUB" + - "Reboot server" + tags: + - set-grub -- name: Turbo boost +- name: Performance Tuning - Turbo boost import_tasks: turbo_boost.yaml when: > cpu_microarchitecture == "skylake" or cpu_microarchitecture == "cascadelake" - tags: turbo-boost + tags: + - turbo-boost -- name: Copy CSIT sysctl file +- name: Performance Tuning - Copy CSIT sysctl file template: - src: 'files/90-csit' - dest: '/etc/sysctl.d/90-csit.conf' - owner: 'root' - group: 'root' - mode: '0644' - tags: copy-90-csit - -- name: Copy IRQ load balancing file - copy: - src: 'files/irqbalance' - dest: '/etc/default/irqbalance' - owner: 'root' - group: 'root' - mode: '0644' - tags: copy-irq - -- name: Copy cpufrequtils file + src: "files/90-csit" + dest: "/etc/sysctl.d/90-csit.conf" + owner: "root" + group: "root" + mode: "0644" + tags: + - copy-90-csit + +- name: Performance Tuning - Copy cpufrequtils file copy: - src: 'files/cpufrequtils' - dest: '/etc/default/cpufrequtils' - owner: 'root' - group: 'root' - mode: '0644' - tags: copy-cpufrequtils - -- name: Set ondemand service to disable + src: "files/cpufrequtils" + dest: "/etc/default/cpufrequtils" + owner: "root" + group: "root" + mode: "0644" + tags: + - copy-cpufrequtils + +- name: Performance Tuning - Set ondemand service to disable service: - name: 'ondemand' - enabled: 'no' - tags: set-ondemand + name: "ondemand" + enabled: "no" + tags: + - set-ondemand -- name: Load vfio-pci by default +- name: Performance Tuning - Load kernel modules by default lineinfile: - path: '/etc/modules' - state: 'present' - line: 'vfio-pci' - tags: load-vfio-pci + path: "/etc/modules" + state: "present" + line: "{{ item }}" + with_items: + - "vfio-pci" + tags: + - load-kernel-modules + +- meta: flush_handlers diff --git a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml index a4872091a5..f6633f5e82 100644 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml @@ -2,32 +2,35 @@ # file: roles/performance_tuning/tasks/turbo_boost.yaml - name: Turbo boost - Install msr-tools - apt: + package: name: - - 'msr-tools' - state: 'present' - cache_valid_time: 3600 - install_recommends: False - tags: turbo-boost + - "msr-tools" + state: latest + update_cache: true + tags: + - turbo-boost - name: Turbo boost - Load msr by default lineinfile: - path: '/etc/modules' - state: 'present' - line: 'msr' - tags: turbo-boost + path: "/etc/modules" + state: "present" + line: "msr" + tags: + - turbo-boost - name: Turbo boost - Custom startup service hook copy: - src: 'files/disable-turbo-boost.service' - dest: '/etc/systemd/system/disable-turbo-boost.service' - owner: 'root' - group: 'root' - mode: '0644' - tags: turbo-boost + src: "files/disable-turbo-boost.service" + dest: "/etc/systemd/system/disable-turbo-boost.service" + owner: "root" + group: "root" + mode: "0644" + tags: + - turbo-boost - name: Turbo boost - Custom startup service hook enable service: - name: 'disable-turbo-boost' + name: "disable-turbo-boost" enabled: yes - tags: turbo-boost + tags: + - turbo-boost 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 deleted file mode 100644 index 62b64be469..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# 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/performance_tuning/tasks/x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml deleted file mode 100644 index 7b66300bc4..0000000000 --- a/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# file: roles/performance_tuning/tasks/x86_64.yaml - -- name: Configure {{ ansible_machine }} kernel parameters - lineinfile: - path: '/etc/default/grub' - state: 'present' - regexp: '^GRUB_CMDLINE_LINUX=' - line: 'GRUB_CMDLINE_LINUX="isolcpus={{ grub.isolcpus }} nohz_full={{ grub.nohz_full }} rcu_nocbs={{ grub.rcu_nocbs }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"' - notify: - - 'Update GRUB' - - 'Reboot server' - tags: set-grub -- cgit 1.2.3-korg