From 51cff72ece689c5eec09a0a52e613696536b9db6 Mon Sep 17 00:00:00 2001 From: navpreetkaur1098 <112065840+navpreetkaur1098@users.noreply.github.com> Date: Thu, 22 Feb 2024 20:47:54 +0530 Subject: [PATCH 01/12] Removed iscvm parameter --- .../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 4d10e002..574f65d2 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -71,10 +71,10 @@ line: "\n boot validation failed since initramfs file is not present." create: yes state: present - when: isCVM is false and initramfs_present.stat.exists == false + when: initramfs_present.stat.exists == false - name: Check for NVME/PCI Drivers in image - when: isCVM is false and initramfs_present.stat.exists == true + when: initramfs_present.stat.exists == true block: - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme @@ -142,7 +142,7 @@ when: rhui_package_count != "0" - name: Check for the Accelerated Networking in Rhel 9 Images. - when: isCVM is false and ansible_distribution_major_version == '9' + when: ansible_distribution_major_version == '9' block: - name: Check if the unmanaged devices are present network config of all Rhel 9 Images shell: NetworkManager --print-config From cf73eafb343d038fc4a5d11d96d62848464b7f24 Mon Sep 17 00:00:00 2001 From: navpreetkaur1098 <112065840+navpreetkaur1098@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:56:27 +0530 Subject: [PATCH 02/12] Update per-vm-validation.yaml --- .../validation-playbooks/per-vm-validation.yaml | 1 - 1 file changed, 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 574f65d2..74def33c 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -63,7 +63,6 @@ - name: Check if the initramfs file is present stat: path=/boot/initramfs-{{ ansible_facts.kernel }}.img register: initramfs_present - when: isCVM is false - name: "Write to error msg if initramfs files are not present" lineinfile: From 0c45f653097c0c8173ce4b000ea597d6c46ef2ef Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 29 Feb 2024 15:34:24 +0530 Subject: [PATCH 03/12] Adding debug task --- .../validation-playbooks/per-vm-validation.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 74def33c..0f084254 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -25,6 +25,14 @@ state: present when: "ansible_distribution_version != rhel_version" +- name: Print the value of iscvm variable" + shell: echo "$isCVM" + register: printcvmvalue + ignore_erros: yes + +- debug: + var: printcvmvalue + - name: Check number of users on the machine shell: getent passwd {1000..60000} | grep -v {{ admin_user }} | wc -l register: users_on_machine From 697eca9276e978f3e12f25dfb8de597a2b8ced7e Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 29 Feb 2024 19:03:32 +0530 Subject: [PATCH 04/12] Corrected the syntax in debug task --- .../validation-playbooks/per-vm-validation.yaml | 1 - 1 file changed, 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 0f084254..aaea4df2 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -28,7 +28,6 @@ - name: Print the value of iscvm variable" shell: echo "$isCVM" register: printcvmvalue - ignore_erros: yes - debug: var: printcvmvalue From db781fbc90b5b6d2b80b8c733284bfcb870536d6 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Thu, 29 Feb 2024 22:43:28 +0530 Subject: [PATCH 05/12] Corrected the syntax in debug task --- .../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 aaea4df2..f63e34d0 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -26,11 +26,11 @@ when: "ansible_distribution_version != rhel_version" - name: Print the value of iscvm variable" - shell: echo "$isCVM" - register: printcvmvalue + shell: echo "$isCVM", "$offer_type", "$rhel_version", "$build_on_rhui4" + register: printvariables - debug: - var: printcvmvalue + var: printvariables - name: Check number of users on the machine shell: getent passwd {1000..60000} | grep -v {{ admin_user }} | wc -l From 73880ffd1e4c1c17a84efd089f7ae799b8977312 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 1 Mar 2024 20:16:12 +0530 Subject: [PATCH 06/12] Corrected syntax of the debug 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 f63e34d0..b9dc94d9 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -26,7 +26,7 @@ when: "ansible_distribution_version != rhel_version" - name: Print the value of iscvm variable" - shell: echo "$isCVM", "$offer_type", "$rhel_version", "$build_on_rhui4" + shell: echo {{isCVM}}, {{offer_type}}, {{rhel_version}}, {{build_on_rhui4}}" register: printvariables - debug: From 86752c2ee646c3768b45533be23d6c35e639c60c Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Fri, 1 Mar 2024 23:35:17 +0530 Subject: [PATCH 07/12] Corrected the syntax in debug 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 b9dc94d9..f0bbfa60 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -25,7 +25,7 @@ state: present when: "ansible_distribution_version != rhel_version" -- name: Print the value of iscvm variable" +- name: Print the value of iscvm variable shell: echo {{isCVM}}, {{offer_type}}, {{rhel_version}}, {{build_on_rhui4}}" register: printvariables From 368e618e2348a2563ed97c7b9e62caaee177fc1f Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 2 Mar 2024 01:09:13 +0530 Subject: [PATCH 08/12] Corrected the syntax in debug 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 f0bbfa60..f636e498 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -26,7 +26,7 @@ when: "ansible_distribution_version != rhel_version" - name: Print the value of iscvm variable - shell: echo {{isCVM}}, {{offer_type}}, {{rhel_version}}, {{build_on_rhui4}}" + shell: echo {{isCVM}}, {{offer_type}}, {{rhel_version}}, {{build_on_rhui4}} register: printvariables - debug: From f6ae67eaf137ded0b7f391cd6aa1647510cf3dce Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 2 Mar 2024 02:51:20 +0530 Subject: [PATCH 09/12] Added iscvm variable back in script --- .../validation-playbooks/per-vm-validation.yaml | 10 +++++++--- 1 file changed, 7 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 f636e498..33dc873c 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -57,6 +57,7 @@ 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 @@ -70,6 +71,7 @@ - name: Check if the initramfs file is present stat: path=/boot/initramfs-{{ ansible_facts.kernel }}.img register: initramfs_present + when: isCVM is False - name: "Write to error msg if initramfs files are not present" lineinfile: @@ -77,10 +79,10 @@ line: "\n boot validation failed since initramfs file is not present." create: yes state: present - when: initramfs_present.stat.exists == false + when: isCVM is False and initramfs_present.stat.exists == false - name: Check for NVME/PCI Drivers in image - when: initramfs_present.stat.exists == true + when: isCVM is False and initramfs_present.stat.exists == true block: - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme @@ -148,7 +150,7 @@ when: rhui_package_count != "0" - name: Check for the Accelerated Networking in Rhel 9 Images. - when: ansible_distribution_major_version == '9' + when: isCVM is False and ansible_distribution_major_version == '9' block: - name: Check if the unmanaged devices are present network config of all Rhel 9 Images shell: NetworkManager --print-config @@ -179,3 +181,5 @@ line: "\n Accelerated Networking Validation failed since unmanaged config file is not present. " when: not check_99_azure_unmanaged_devices_config_file.stat.exists + + From 54725d5f94055e4a3701075210364b530a78626a Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 2 Mar 2024 18:10:23 +0530 Subject: [PATCH 10/12] Corrected the syntax task of debugging --- .../validation-playbooks/per-vm-validation.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 33dc873c..82766a6d 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -71,7 +71,7 @@ - name: Check if the initramfs file is present stat: path=/boot/initramfs-{{ ansible_facts.kernel }}.img register: initramfs_present - when: isCVM is False + when: isCVM is false - name: "Write to error msg if initramfs files are not present" lineinfile: @@ -79,10 +79,10 @@ line: "\n boot validation failed since initramfs file is not present." create: yes state: present - when: isCVM is False and initramfs_present.stat.exists == false + when: isCVM is false and initramfs_present.stat.exists == false - name: Check for NVME/PCI Drivers in image - when: isCVM is False and initramfs_present.stat.exists == true + when: isCVM is false and initramfs_present.stat.exists == true block: - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme @@ -150,7 +150,7 @@ when: rhui_package_count != "0" - name: Check for the Accelerated Networking in Rhel 9 Images. - when: isCVM is False and ansible_distribution_major_version == '9' + when: isCVM is false and ansible_distribution_major_version == '9' block: - name: Check if the unmanaged devices are present network config of all Rhel 9 Images shell: NetworkManager --print-config From b55abd67e188c27704c6c454bb229becbb42607a Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Sat, 2 Mar 2024 20:28:02 +0530 Subject: [PATCH 11/12] Added the iscvm value --- .../validation-playbooks/per-vm-validation.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index 82766a6d..c719de44 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -71,7 +71,7 @@ - name: Check if the initramfs file is present stat: path=/boot/initramfs-{{ ansible_facts.kernel }}.img register: initramfs_present - when: isCVM is false + when: isCVM == false - name: "Write to error msg if initramfs files are not present" lineinfile: @@ -79,10 +79,10 @@ line: "\n boot validation failed since initramfs file is not present." create: yes state: present - when: isCVM is false and initramfs_present.stat.exists == false + when: isCVM == false and initramfs_present.stat.exists == false - name: Check for NVME/PCI Drivers in image - when: isCVM is false and initramfs_present.stat.exists == true + when: isCVM == false and initramfs_present.stat.exists == true block: - name: Check if the nvme driver is present in all images shell: lsinitrd /boot/initramfs-{{ ansible_facts.kernel }}.img | grep nvme @@ -150,7 +150,7 @@ when: rhui_package_count != "0" - name: Check for the Accelerated Networking in Rhel 9 Images. - when: isCVM is false and ansible_distribution_major_version == '9' + when: isCVM == false and ansible_distribution_major_version == '9' block: - name: Check if the unmanaged devices are present network config of all Rhel 9 Images shell: NetworkManager --print-config From 8c18f460cad423e4fe421f18f8082177bd8b6af3 Mon Sep 17 00:00:00 2001 From: navpreetkaur Date: Tue, 5 Mar 2024 15:29:57 +0530 Subject: [PATCH 12/12] Added debug for checking conditional statement --- .../validation-playbooks/per-vm-validation.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml index c719de44..f097fd9e 100644 --- a/ansible_image_validation/validation-playbooks/per-vm-validation.yaml +++ b/ansible_image_validation/validation-playbooks/per-vm-validation.yaml @@ -32,6 +32,10 @@ - debug: var: printvariables +- name: check the value of iscvm is false condition + ansible.builtin.debug: + var: isCVM is false + - name: Check number of users on the machine shell: getent passwd {1000..60000} | grep -v {{ admin_user }} | wc -l register: users_on_machine