fix(Terraform): Bug fixes and lint tweaks
[csit.git] / fdio.infra.ansible / roles / calibration / tasks / main.yaml
1 ---
2 # file: roles/calibration/tasks/main.yaml
3
4 - name: Inst - Update Package Cache (APT)
5   apt:
6     update_cache: true
7     cache_valid_time: 3600
8   when:
9     - ansible_distribution|lower == 'ubuntu'
10   tags:
11     - calibration-inst-prerequisites
12
13 - name: Inst - Prerequisites
14   package:
15     name: "{{ packages | flatten(levels=1) }}"
16     state: latest
17   tags:
18     - calibration-inst-prerequisites
19
20 - name: Check CPU Power States
21   shell: "lscpu"
22   register: current_lscpu
23   changed_when: false
24   tags:
25     - check-cpu-frequency
26
27 - name: Check CPU Power States
28   assert:
29     that:
30       - "'CPU min MHz' not in current_lscpu.stdout or 'Intel(R) Xeon(R)' not in ansible_processor"
31     fail_msg: "CPU configuration!"
32     success_msg: "CPU configuration match."
33   tags:
34     - check-cpu-frequency
35
36 - name: Check Kernel Parameters
37   assert:
38     that:
39       - item in ansible_cmdline
40     fail_msg: "Kernel parameters!"
41     success_msg: "Kernel parameters match."
42   loop: "{{ grub.keys()|sort }}"
43   when:
44     - grub is defined
45   tags:
46     - check-kernel-params
47
48 - name: Check Kernel Version
49   assert:
50     that:
51       - ansible_kernel not in kernel_version_by_distro_by_arch
52     fail_msg: "Kernel version!"
53     success_msg: "Kernel version match."
54   tags:
55     - check-kernel-version
56
57 - name: Spectre Meltdown Checker Status
58   stat:
59     path: "/opt/spectre-meltdown-checker.sh"
60   register: spectre_meltdown_status
61   tags:
62     - check-spectre-meltdown
63
64 - name: Get Spectre Meltdown Checker
65   get_url:
66     url: "https://meltdown.ovh"
67     dest: "/opt/spectre-meltdown-checker.sh"
68     mode: "744"
69   when:
70     - not spectre_meltdown_status.stat.exists
71   tags:
72     - check-spectre-meltdown
73
74 - name: Run Spectre Meltdown Checker
75   shell: "/opt/spectre-meltdown-checker.sh --no-color --sysfs-only || true"
76   ignore_errors: true
77   register: spectre_meltdown_sync
78   tags:
79     - check-spectre-meltdown
80
81 - debug: var=spectre_meltdown_sync.stdout_lines
82   tags:
83     - check-spectre-meltdown
84
85 - name: "{{ ansible_machine }} Specific"
86   include_tasks: "{{ ansible_machine }}.yaml"
87   tags:
88     - check-machine-specific
89     - check-jitter-tool