aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/calibration
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-04-08 10:44:18 +0000
committerPeter Mikus <pmikus@cisco.com>2021-04-08 11:17:15 +0000
commitdf5672b3d9c29b51397f4770eb992c9f3f3955ce (patch)
treeadb4cf36c9b680ebbc44c953391a0d21b986d6b7 /fdio.infra.ansible/roles/calibration
parent8018da98e0f362bc69fc9600fac222a86fd46b5e (diff)
Ansible git move
+ Better accessibility + Compliant with fdio.infra._function_ - function [pxe|terraform|ansible|vagrant] + dill==0.3.3 also applied on TBs - ci-man to follow today - Docs to be updated in separate patch Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: Iff9eaa29d63044188cc8160db2d9b44b7635782a
Diffstat (limited to 'fdio.infra.ansible/roles/calibration')
-rw-r--r--fdio.infra.ansible/roles/calibration/defaults/main.yaml47
-rw-r--r--fdio.infra.ansible/roles/calibration/tasks/aarch64.yaml2
-rw-r--r--fdio.infra.ansible/roles/calibration/tasks/main.yaml89
-rw-r--r--fdio.infra.ansible/roles/calibration/tasks/x86_64.yaml35
4 files changed, 173 insertions, 0 deletions
diff --git a/fdio.infra.ansible/roles/calibration/defaults/main.yaml b/fdio.infra.ansible/roles/calibration/defaults/main.yaml
new file mode 100644
index 0000000000..020c0119b1
--- /dev/null
+++ b/fdio.infra.ansible/roles/calibration/defaults/main.yaml
@@ -0,0 +1,47 @@
+---
+# file: roles/calibration/defaults/main.yaml
+
+# Packages to install.
+packages: "{{ packages_base + packages_by_distro[ansible_distribution|lower][ansible_distribution_release] + packages_by_arch[ansible_machine] }}"
+
+packages_base:
+ - []
+
+packages_by_distro:
+ ubuntu:
+ bionic:
+ - "build-essential"
+ - "dmidecode"
+ focal:
+ - "build-essential"
+ - "dmidecode"
+
+packages_by_arch:
+ aarch64:
+ - []
+ x86_64:
+ - []
+
+# Kernel version to check.
+kernel_version: "{{ kernel_version_by_distro_by_arch[ansible_distribution | lower][ansible_distribution_release][ansible_machine] }}"
+
+kernel_version_by_distro_by_arch:
+ ubuntu:
+ bionic:
+ x86_64:
+ - "4.15.0-72-generic"
+ - "5.3.0-1020-azure"
+ - "4.15.0-1057-aws"
+ aarch64:
+ - "4.15.0-54-generic"
+ focal:
+ x86_64:
+ - "5.4.0-65-generic"
+ - "5.3.0-1020-azure"
+ - "5.4.0-1035-aws"
+ aarch64:
+ - "5.4.0-65-generic"
+
+pma_directory: "/tmp/pma_tools"
+jitter_core: 7
+jitter_iterations: 20
diff --git a/fdio.infra.ansible/roles/calibration/tasks/aarch64.yaml b/fdio.infra.ansible/roles/calibration/tasks/aarch64.yaml
new file mode 100644
index 0000000000..ca4e75d268
--- /dev/null
+++ b/fdio.infra.ansible/roles/calibration/tasks/aarch64.yaml
@@ -0,0 +1,2 @@
+---
+# file: roles/calibration/tasks/aarch64.yaml
diff --git a/fdio.infra.ansible/roles/calibration/tasks/main.yaml b/fdio.infra.ansible/roles/calibration/tasks/main.yaml
new file mode 100644
index 0000000000..696f1c9265
--- /dev/null
+++ b/fdio.infra.ansible/roles/calibration/tasks/main.yaml
@@ -0,0 +1,89 @@
+---
+# file: roles/calibration/tasks/main.yaml
+
+- name: Inst - Update Package Cache (APT)
+ apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ when:
+ - ansible_distribution|lower == 'ubuntu'
+ tags:
+ - calibration-inst-prerequisites
+
+- name: Inst - Prerequisites
+ package:
+ name: "{{ packages | flatten(levels=1) }}"
+ state: latest
+ tags:
+ - calibration-inst-prerequisites
+
+- name: Check CPU Power States
+ shell: "lscpu"
+ register: current_lscpu
+ changed_when: false
+ tags:
+ - check-cpu-frequency
+
+- name: Check CPU Power States
+ assert:
+ that:
+ - "'CPU min MHz' not in current_lscpu.stdout or 'Intel(R) Xeon(R)' not in ansible_processor"
+ fail_msg: "CPU configuration!"
+ success_msg: "CPU configuration match."
+ tags:
+ - check-cpu-frequency
+
+- name: Check Kernel Parameters
+ assert:
+ that:
+ - item in ansible_cmdline and grub[item] == ansible_cmdline[item]
+ fail_msg: "Kernel parameters!"
+ success_msg: "Kernel parameters match."
+ loop: "{{ grub.keys()|sort }}"
+ when:
+ - grub is defined
+ tags:
+ - check-kernel-params
+
+- name: Check Kernel Version
+ assert:
+ that:
+ - ansible_kernel not in kernel_version_by_distro_by_arch
+ fail_msg: "Kernel version!"
+ success_msg: "Kernel version match."
+ tags:
+ - check-kernel-version
+
+- name: Get Spectre Meltdown Checker
+ get_url:
+ url: "https://meltdown.ovh"
+ dest: "/opt/spectre-meltdown-checker.sh"
+ mode: "744"
+ tags:
+ - check-spectre-meltdown
+
+- name: Run Spectre Meltdown Checker
+ shell: "/opt/spectre-meltdown-checker.sh --no-color || true"
+ async: 60
+ poll: 0
+ ignore_errors: true
+ register: spectre_meltdown_async
+ tags:
+ - check-spectre-meltdown
+
+- name: "{{ ansible_machine }} Specific"
+ include_tasks: "{{ ansible_machine }}.yaml"
+ tags:
+ - check-machine-specific
+ - check-jitter-tool
+
+- name: Check Sync Status
+ async_status:
+ jid: "{{ spectre_meltdown_async.ansible_job_id }}"
+ register: "spectre_meltdown_poll_results"
+ until: spectre_meltdown_poll_results.finished
+ retries: 30
+
+- debug: var=spectre_meltdown_poll_results.stdout_lines
+ tags:
+ - check-spectre-meltdown
diff --git a/fdio.infra.ansible/roles/calibration/tasks/x86_64.yaml b/fdio.infra.ansible/roles/calibration/tasks/x86_64.yaml
new file mode 100644
index 0000000000..90b1c954b5
--- /dev/null
+++ b/fdio.infra.ansible/roles/calibration/tasks/x86_64.yaml
@@ -0,0 +1,35 @@
+---
+# file: roles/calibration/tasks/x86_64.yaml
+
+- name: Calibration - Clone PMA Tool
+ git:
+ repo: "https://gerrit.fd.io/r/pma_tools"
+ dest: "{{ pma_directory }}"
+ tags:
+ - check-jitter-tool
+
+- name: Calibration - Compile PMA Tool
+ raw: "cd {{ pma_directory }}/jitter && make"
+ tags:
+ - check-jitter-tool
+
+- name: Calibration - Run Jitter Tool
+ shell: "{{ pma_directory }}/jitter/jitter -c {{ jitter_core }} -i {{ jitter_iterations }} -f"
+ become: yes
+ async: 60
+ poll: 0
+ ignore_errors: yes
+ register: jitter_async
+ tags:
+ - check-jitter-tool
+
+- name: Check sync status
+ async_status:
+ jid: "{{ jitter_async.ansible_job_id }}"
+ register: "jitter_poll_results"
+ until: jitter_poll_results.finished
+ retries: 30
+
+- debug: var=jitter_poll_results.stdout_lines
+ tags:
+ - check-jitter-tool