From 0b9d27f4432baafa17f04b68d096f64c8b29734a Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 22 Jun 2023 13:41:11 +0530 Subject: [PATCH 01/16] Added nvme_driver_validation.yml file --- .../nvme_driver_validation.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ansible_image_validation/validation-playbooks/nvme_driver_validation.yml diff --git a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml new file mode 100644 index 00000000..e43a573c --- /dev/null +++ b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml @@ -0,0 +1,14 @@ +### +# This Playbook checks if the nvme and pci drivers are present in the given image +# Author: Navpreet Kaur +### +--- +- name: Check if the drivers are blacklisted all images + shell: lsinitrd /boot | grep "{{item}}" + register: check_drivers_allimages + with_items: + - nvme + - pci + +- debug: + var: check_drivers_allimages \ No newline at end of file From d874f14469f8c9da559ce5f495e71946a9093a12 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 22 Jun 2023 22:15:19 +0530 Subject: [PATCH 02/16] Modified the task name --- .../validation-playbooks/nvme_driver_validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml index e43a573c..7e968c6c 100644 --- a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml +++ b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml @@ -3,7 +3,7 @@ # Author: Navpreet Kaur ### --- -- name: Check if the drivers are blacklisted all images +- name: Check if the nvme and pci drivers are present i all images shell: lsinitrd /boot | grep "{{item}}" register: check_drivers_allimages with_items: From 88c6dae6bdb9a443507563c2aa0f04b5cb8bb81c Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 30 Jun 2023 19:52:33 +0530 Subject: [PATCH 03/16] Added tasks to validate nvme and pci drivers --- .../per-vm-validation.yaml | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 32391692..67576eb6 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -58,4 +58,26 @@ - name: Check if blacklisted drivers are blacklisted by modprobe service include_tasks: validation-playbooks/blacklisted_drivers_validation.yaml ignore_errors: yes - when: ansible_os_family == "RedHat" \ No newline at end of file + when: ansible_os_family == "RedHat" + +- name: Check the kernel version + shell: uname -r + register: output_kernel_version + +- debug: + var: output_kernel_version.stdout_lines + +- name: Set the kernel version + set_fact: + kernel_version: "{{ output_kernel_version.stdout_lines | join}}" + +- debug: + var: kernel_version + +- name: Check if the nvme and pci drivers are present i all images + shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep {{ item }} + register: check_drivers_allimages + with_items: + - nvme + - pci + failed_when: '"does not exist" in check_drivers_allimages.stderr' \ No newline at end of file From 811534f7b411bce27382346e99e80c2d9f3437b5 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 1 Jul 2023 01:31:15 +0530 Subject: [PATCH 04/16] Added seperate tasks to validate nvme and pci drivers --- .../per-vm-validation.yaml | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 67576eb6..60bf68f9 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -74,10 +74,18 @@ - debug: var: kernel_version -- name: Check if the nvme and pci drivers are present i all images - shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep {{ item }} - register: check_drivers_allimages - with_items: - - nvme - - pci - failed_when: '"does not exist" in check_drivers_allimages.stderr' \ No newline at end of file +- name: Check if the nvme drivers are present i all images + shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep nvme + register: check_nvme_allimages + failed_when: '"nvme" not in check_nvme_allimages.stdout' + +- debug: + var: check_nvme_allimages + +- name: Check if the pci drivers are present i all images + shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep pci + register: check_pci_allimages + failed_when: '"pci" not in check_pci_allimages.stdout' + +- debug: + var: check_pci_allimages \ No newline at end of file From d9b64288cab985cf915275a017ce901d59450912 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 1 Jul 2023 01:37:48 +0530 Subject: [PATCH 05/16] Added seperate tasks to validate nvme and pci drivers --- .../nvme_driver_validation.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 ansible_image_validation/validation-playbooks/nvme_driver_validation.yml diff --git a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml deleted file mode 100644 index 7e968c6c..00000000 --- a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yml +++ /dev/null @@ -1,14 +0,0 @@ -### -# This Playbook checks if the nvme and pci drivers are present in the given image -# Author: Navpreet Kaur -### ---- -- name: Check if the nvme and pci drivers are present i all images - shell: lsinitrd /boot | grep "{{item}}" - register: check_drivers_allimages - with_items: - - nvme - - pci - -- debug: - var: check_drivers_allimages \ No newline at end of file From 843de3da0292f75e17eb610ec98e8d6dc53e806e Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Tue, 4 Jul 2023 18:45:45 +0530 Subject: [PATCH 06/16] Modified the task to check kernel version --- .../validation-playbooks/per-vm-validation.yaml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 60bf68f9..81194bc8 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -60,19 +60,13 @@ ignore_errors: yes when: ansible_os_family == "RedHat" -- name: Check the kernel version - shell: uname -r - register: output_kernel_version - -- debug: - var: output_kernel_version.stdout_lines +- name: Print all available facts + ansible.builtin.debug: + var: ansible_facts["kernel"] - name: Set the kernel version set_fact: - kernel_version: "{{ output_kernel_version.stdout_lines | join}}" - -- debug: - var: kernel_version + kernel_version: "{{ ansible_facts['kernel'] | join}}" - name: Check if the nvme drivers are present i all images shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep nvme From 5bf372faae33a124065c80b1cf5b17af373a4ed5 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Wed, 5 Jul 2023 20:26:33 +0530 Subject: [PATCH 07/16] Added a task to save error messages in err.log file --- .../per-vm-validation.yaml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 81194bc8..3210d423 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -60,26 +60,24 @@ ignore_errors: yes when: ansible_os_family == "RedHat" -- name: Print all available facts - ansible.builtin.debug: - var: ansible_facts["kernel"] - -- name: Set the kernel version - set_fact: - kernel_version: "{{ ansible_facts['kernel'] | join}}" - - name: Check if the nvme drivers are present i all images - shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep nvme + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme register: check_nvme_allimages - failed_when: '"nvme" not in check_nvme_allimages.stdout' - debug: var: check_nvme_allimages -- name: Check if the pci drivers are present i all images - shell: lsinitrd /boot/initramfs-{{ kernel_version }}.img | grep pci +- name: Check if the pci drivers are present i all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep pci register: check_pci_allimages - failed_when: '"pci" not in check_pci_allimages.stdout' - debug: - var: check_pci_allimages \ No newline at end of file + var: check_pci_allimages + +- name: "Write to error msg if some drivers are not present" + lineinfile: + path: "{{err_folder}}/err_msgs.log" + line: "\nFailed to find the nvme and pci drivers" + create: yes + state: present + when: ("pci" not in check_pci_allimages.stdout) or ("nvme" not in check_pci_allimages.stdout) \ No newline at end of file From 0b1bcddbecdcd5d2b91db18e3abd525b1fa678db Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sun, 9 Jul 2023 00:53:41 +0530 Subject: [PATCH 08/16] Modified the nvme drivers validation tasks in per-vm-validation.yml file --- .../per-vm-validation.yaml | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 3210d423..ba7c141c 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -60,24 +60,20 @@ ignore_errors: yes when: ansible_os_family == "RedHat" -- name: Check if the nvme drivers are present i all images - shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme - register: check_nvme_allimages - -- debug: - var: check_nvme_allimages - -- name: Check if the pci drivers are present i all images - shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep pci - register: check_pci_allimages +- name: Check if the nvme drivers are present in all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep {{ item }} + register: check_nvme_pci_allimages + with_items: + - nvme + - pci - debug: - var: check_pci_allimages + var: check_nvme_pci_allimages.results - name: "Write to error msg if some drivers are not present" lineinfile: path: "{{err_folder}}/err_msgs.log" - line: "\nFailed to find the nvme and pci drivers" + line: "\n Errors Detected as shown below: \n {{ check_nvme_pci_allimages.results }} " create: yes state: present - when: ("pci" not in check_pci_allimages.stdout) or ("nvme" not in check_pci_allimages.stdout) \ No newline at end of file + when: ("nvme" not in check_nvme_pci_allimages.results[0].stdout) or ("pci" not in check_nvme_pci_allimages.results[1].stdout) \ No newline at end of file From 6d5cf12940a86ce38894ae803cbe99d5b027e850 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sun, 9 Jul 2023 00:59:16 +0530 Subject: [PATCH 09/16] Added a keyword pci in the nvme drivers validation tasks in per-vm-validation.yml file --- .../validation-playbooks/per-vm-validation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index ba7c141c..8a8c13ed 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -60,7 +60,7 @@ ignore_errors: yes when: ansible_os_family == "RedHat" -- name: Check if the nvme drivers are present in all images +- name: Check if the nvme and pci drivers are present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep {{ item }} register: check_nvme_pci_allimages with_items: From 40f25b6eaa07c46f20090cb5c55f9028ff2a78ca Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 13 Jul 2023 16:00:25 +0530 Subject: [PATCH 10/16] Added a task to print the list of missing drivers --- .../validation-playbooks/per-vm-validation.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 8a8c13ed..e1d1b27c 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -73,7 +73,13 @@ - name: "Write to error msg if some drivers are not present" lineinfile: path: "{{err_folder}}/err_msgs.log" - line: "\n Errors Detected as shown below: \n {{ check_nvme_pci_allimages.results }} " + line: "\n NVME validation failed since driver is not present. " create: yes - state: present - when: ("nvme" not in check_nvme_pci_allimages.results[0].stdout) or ("pci" not in check_nvme_pci_allimages.results[1].stdout) \ No newline at end of file + state: present + when: ("nvme" not in check_nvme_pci_allimages.results[0].stdout) or ("pci" not in check_nvme_pci_allimages.results[1].stdout) + +- name: "Get list of missing drivers required for nvme validation" + set_fact: missing_drivers="{{ check_nvme_pci_allimages.results | json_query(jmesquery)}}" + vars: + jmesquery: '[?rc==`1`].stdout' + when: check_nvme_pci_allimages is not succeeded \ No newline at end of file From ed6ae4cf991edeaa4a8dcdaa4ceccc53e8ec4cbf Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 14 Jul 2023 14:33:58 +0530 Subject: [PATCH 11/16] Rearranged tasks --- .../per-vm-validation.yaml | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index e1d1b27c..fc103fea 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -60,26 +60,32 @@ ignore_errors: yes when: ansible_os_family == "RedHat" -- name: Check if the nvme and pci drivers are present in all images - shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep {{ item }} - register: check_nvme_pci_allimages - with_items: - - nvme - - pci +- name: Check if the nvme driver is present in all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme + register: check_nvme_allimages - debug: - var: check_nvme_pci_allimages.results + var: check_nvme_allimages - name: "Write to error msg if some drivers are not present" lineinfile: path: "{{err_folder}}/err_msgs.log" - line: "\n NVME validation failed since driver is not present. " + line: "\n NVME validation failed since nvme driver is not present. " create: yes state: present - when: ("nvme" not in check_nvme_pci_allimages.results[0].stdout) or ("pci" not in check_nvme_pci_allimages.results[1].stdout) + when: ("nvme" not in check_nvme_allimages.stdout) -- name: "Get list of missing drivers required for nvme validation" - set_fact: missing_drivers="{{ check_nvme_pci_allimages.results | json_query(jmesquery)}}" - vars: - jmesquery: '[?rc==`1`].stdout' - when: check_nvme_pci_allimages is not succeeded \ No newline at end of file +- name: Check if the pci driver is present in all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep pci + register: check_pci_allimages + +- debug: + var: check_pci_allimages + +- name: "Write to error msg if some drivers are not present" + lineinfile: + path: "{{err_folder}}/err_msgs.log" + line: "\n PCI validation failed since pci driver is not present. " + create: yes + state: present + when: ("pci" not in check_pci_allimages.stdout) \ No newline at end of file From d9187c43ff00e5fb3bc788ba224dd3679056c5a5 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 14 Jul 2023 17:16:01 +0530 Subject: [PATCH 12/16] Corrected the line in a task --- .../validation-playbooks/per-vm-validation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index fc103fea..d7b29a01 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -85,7 +85,7 @@ - name: "Write to error msg if some drivers are not present" lineinfile: path: "{{err_folder}}/err_msgs.log" - line: "\n PCI validation failed since pci driver is not present. " + line: "\n NVME validation failed since pci driver is not present. " create: yes state: present when: ("pci" not in check_pci_allimages.stdout) \ No newline at end of file From cff4f300e140adbec886e2205050b3e893087f64 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 14 Jul 2023 23:30:59 +0530 Subject: [PATCH 13/16] Modified debug statements --- .../validation-playbooks/per-vm-validation.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index d7b29a01..b506221f 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -65,12 +65,12 @@ register: check_nvme_allimages - debug: - var: check_nvme_allimages + msg: "NVME Validation is successful since nvme driver is present" - name: "Write to error msg if some drivers are not present" lineinfile: path: "{{err_folder}}/err_msgs.log" - line: "\n NVME validation failed since nvme driver is not present. " + line: "\n NVME validation failed since nvme driver is not present." create: yes state: present when: ("nvme" not in check_nvme_allimages.stdout) @@ -80,7 +80,7 @@ register: check_pci_allimages - debug: - var: check_pci_allimages + msg: "NVME Validation is successful since nvme driver is present" - name: "Write to error msg if some drivers are not present" lineinfile: From f83ab58ef03ebb675a75c922a886364bebd74c09 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sun, 16 Jul 2023 21:32:41 +0530 Subject: [PATCH 14/16] Rearranged tasks in per-vm-validation.yaml file. --- .../validation-playbooks/per-vm-validation.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index b506221f..a6dc8672 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -55,11 +55,6 @@ ignore_errors: yes when: ansible_os_family == "RedHat" and (ansible_distribution_major_version == '8' or ansible_distribution_major_version == '7') and (repo_type == 'base' or repo_type =='beta') -- name: Check if blacklisted drivers are blacklisted by modprobe service - include_tasks: validation-playbooks/blacklisted_drivers_validation.yaml - ignore_errors: yes - when: ansible_os_family == "RedHat" - - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme register: check_nvme_allimages @@ -88,4 +83,9 @@ line: "\n NVME validation failed since pci driver is not present. " create: yes state: present - when: ("pci" not in check_pci_allimages.stdout) \ No newline at end of file + when: ("pci" not in check_pci_allimages.stdout) + +- name: Check if blacklisted drivers are blacklisted by modprobe service + include_tasks: validation-playbooks/blacklisted_drivers_validation.yaml + ignore_errors: yes + when: ansible_os_family == "RedHat" \ No newline at end of file From 35295e5122cca3305267fe84018f9778545077a4 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sun, 16 Jul 2023 22:51:36 +0530 Subject: [PATCH 15/16] Rearranged tasks in per-vm-validation.yaml file. --- .../validation-playbooks/per-vm-validation.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index a6dc8672..3b81f537 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -50,11 +50,6 @@ state: present when: users_on_machine.stdout_lines[0] != '0' -- name: check if ADE validation is valid for this vm - include_tasks: validation-playbooks/ade_packages_validation.yaml - ignore_errors: yes - when: ansible_os_family == "RedHat" and (ansible_distribution_major_version == '8' or ansible_distribution_major_version == '7') and (repo_type == 'base' or repo_type =='beta') - - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme register: check_nvme_allimages @@ -83,7 +78,13 @@ line: "\n NVME validation failed since pci driver is not present. " create: yes state: present - when: ("pci" not in check_pci_allimages.stdout) + when: ("pci" not in check_pci_allimages.stdout) + +- name: check if ADE validation is valid for this vm + include_tasks: validation-playbooks/ade_packages_validation.yaml + ignore_errors: yes + when: ansible_os_family == "RedHat" and (ansible_distribution_major_version == '8' or ansible_distribution_major_version == '7') and (repo_type == 'base' or repo_type =='beta') + - name: Check if blacklisted drivers are blacklisted by modprobe service include_tasks: validation-playbooks/blacklisted_drivers_validation.yaml From 0d1b152607af947d1cff38e76ab430c16408b2af Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sun, 16 Jul 2023 23:00:17 +0530 Subject: [PATCH 16/16] Created a separate file for nvme validation to follow the chronological order of other validation tasks --- .../nvme_driver_validation.yaml | 32 ++++++++++++++++++ .../per-vm-validation.yaml | 33 ++----------------- 2 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 ansible_image_validation/validation-playbooks/nvme_driver_validation.yaml diff --git a/ansible_image_validation/validation-playbooks/nvme_driver_validation.yaml b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yaml new file mode 100644 index 00000000..371ef3dc --- /dev/null +++ b/ansible_image_validation/validation-playbooks/nvme_driver_validation.yaml @@ -0,0 +1,32 @@ + +--- + +- name: Check if the nvme driver is present in all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme + register: check_nvme_allimages + +- debug: + msg: "NVME Validation is successful since nvme driver is present" + +- name: "Write to error msg if some drivers are not present" + lineinfile: + path: "{{err_folder}}/err_msgs.log" + line: "\n NVME validation failed since nvme driver is not present." + create: yes + state: present + when: ("nvme" not in check_nvme_allimages.stdout) + +- name: Check if the pci driver is present in all images + shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep pci + register: check_pci_allimages + +- debug: + msg: "NVME Validation is successful since nvme driver is present" + +- name: "Write to error msg if some drivers are not present" + lineinfile: + path: "{{err_folder}}/err_msgs.log" + line: "\n NVME validation failed since pci driver is not present. " + create: yes + state: present + when: ("pci" not in check_pci_allimages.stdout) \ No newline at end of file diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 3b81f537..e305137e 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -50,42 +50,15 @@ state: present when: users_on_machine.stdout_lines[0] != '0' -- name: Check if the nvme driver is present in all images - shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme - register: check_nvme_allimages - -- debug: - msg: "NVME Validation is successful since nvme driver is present" - -- name: "Write to error msg if some drivers are not present" - lineinfile: - path: "{{err_folder}}/err_msgs.log" - line: "\n NVME validation failed since nvme driver is not present." - create: yes - state: present - when: ("nvme" not in check_nvme_allimages.stdout) - -- name: Check if the pci driver is present in all images - shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep pci - register: check_pci_allimages - -- debug: - msg: "NVME Validation is successful since nvme driver is present" - -- name: "Write to error msg if some drivers are not present" - lineinfile: - path: "{{err_folder}}/err_msgs.log" - line: "\n NVME validation failed since pci driver is not present. " - create: yes - state: present - when: ("pci" not in check_pci_allimages.stdout) +- name: Check if NVME Validation is valid for this VM + include_tasks: validation-playbooks/nvme_driver_validation.yaml + ignore_errors: yes - name: check if ADE validation is valid for this vm include_tasks: validation-playbooks/ade_packages_validation.yaml ignore_errors: yes when: ansible_os_family == "RedHat" and (ansible_distribution_major_version == '8' or ansible_distribution_major_version == '7') and (repo_type == 'base' or repo_type =='beta') - - name: Check if blacklisted drivers are blacklisted by modprobe service include_tasks: validation-playbooks/blacklisted_drivers_validation.yaml ignore_errors: yes