From d3e0654a57aa958aaef1906e4a759e521655a86b Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Wed, 16 Oct 2019 16:25:41 +0000 Subject: Ansible: Role cleanup + Separate and reuse role (better naming) + Cleanup in naming + Introduce defaults that can be overriden Signed-off-by: Peter Mikus Change-Id: Iedaf7caba1d05a35a6f61cd21a483cdbc0073d32 --- .../roles/performance_tuning/tasks/aarch64.yaml | 12 +++++ .../roles/performance_tuning/tasks/main.yaml | 57 ++++++++++++++++++++++ .../performance_tuning/tasks/turbo_boost.yaml | 33 +++++++++++++ .../performance_tuning/tasks/ubuntu_bionic.yaml | 11 +++++ .../roles/performance_tuning/tasks/x86_64.yaml | 13 +++++ 5 files changed, 126 insertions(+) create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/ubuntu_bionic.yaml create mode 100644 resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml (limited to 'resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks') 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 new file mode 100644 index 0000000000..b5ff02a9ca --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/aarch64.yaml @@ -0,0 +1,12 @@ +--- +# 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 new file mode 100644 index 0000000000..348bccbb33 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/main.yaml @@ -0,0 +1,57 @@ +--- +# 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: Machine specifics + include_tasks: '{{ ansible_machine }}.yaml' + tags: set-grub + +- name: Turbo boost + import_tasks: turbo_boost.yaml + when: > + cpu_microarchitecture == "skylake" or + cpu_microarchitecture == "cascadelake" + tags: turbo-boost + +- name: 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 + copy: + src: 'files/cpufrequtils' + dest: '/etc/default/cpufrequtils' + owner: 'root' + group: 'root' + mode: '0644' + tags: copy-cpufrequtils + +- name: Set ondemand service to disable + service: + name: 'ondemand' + enabled: 'no' + tags: set-ondemand + +- name: Load vfio-pci by default + lineinfile: + path: '/etc/modules' + state: 'present' + line: 'vfio-pci' + tags: load-vfio-pci 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 new file mode 100644 index 0000000000..a4872091a5 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/turbo_boost.yaml @@ -0,0 +1,33 @@ +--- +# file: roles/performance_tuning/tasks/turbo_boost.yaml + +- name: Turbo boost - Install msr-tools + apt: + name: + - 'msr-tools' + state: 'present' + cache_valid_time: 3600 + install_recommends: False + tags: turbo-boost + +- name: Turbo boost - Load msr by default + lineinfile: + 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 + +- name: Turbo boost - Custom startup service hook enable + service: + name: 'disable-turbo-boost' + enabled: yes + 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 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/performance_tuning/tasks/x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml new file mode 100644 index 0000000000..7b66300bc4 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/performance_tuning/tasks/x86_64.yaml @@ -0,0 +1,13 @@ +--- +# 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