Browse Source

Update validate_provision_vars.yml

Signed-off-by: abhishek-sa1 <abhishek.sa3@dell.com>
abhishek-sa1 3 years ago
parent
commit
141a09a5ba

+ 80 - 0
control_plane/roles/control_plane_common/tasks/validate_provision_vars.yml

@@ -1 +1,81 @@
+# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+---
 
+- name: Convert timezone.txt to linux format
+  command: dos2unix {{ role_path }}/files/timezone.txt
+  failed_when: false
+  changed_when: false
+
+- name: Searching for timezone
+  lineinfile:
+    path: "{{ role_path }}/files/timezone.txt"
+    line: "{{ timezone }}"
+    state: present
+  check_mode: yes
+  register: timezone_search
+
+- name: Assert timezone
+  assert:
+    that: timezone_search is not changed
+    success_msg: "{{ success_timezone_msg }}"
+    fail_msg: "{{ fail_timezone_msg }}"
+  register: timezone_check
+
+- name: Assert language for provisioning nodes
+  fail:
+    msg: "{{ fail_language }}"
+  when: '"en-US" not in language'
+
+- name: Assert provisioning method
+  assert:
+    that:
+      - provision_method == "PXE" or provision_method == "idrac"
+    success_msg: "{{ success_provision_method }}"
+    fail_msg: "{{ fail_provision_method }}"
+
+- name: Assert provision_state
+  assert:
+    that: 
+      - provision_state == "stateful"
+    fail_msg: "{{ provision_state_fail_msg }}"
+    success_msg: "{{ provision_state_success_msg }}"
+
+- name: Assert operating system
+  assert:
+    that:
+      - provision_os == os_supported_centos or 
+        provision_os == os_supported_rocky or
+        provision_os == os_supported_leap
+    fail_msg: "{{ provision_os_fail_msg }}"
+    success_msg: "{{ provision_os_success_msg }}"
+
+- name: Verify the iso_file_path
+  stat:
+    path: "{{ iso_file_path }}"
+  register: result_path_iso_file
+
+- name : Assert iso_file_path location
+  fail:
+    msg: "{{ missing_iso_file_path }}"
+  when: not result_path_iso_file.stat.exists
+
+- name: Validate iso_file_path name
+  assert:
+    that:
+      - result_path_iso_file.stat.exists
+      - '".iso" in iso_file_path'
+      - provision_os in iso_file_path | lower
+    fail_msg: "{{ invalid_iso_file_path }}"
+    success_msg:  "{{ valid_iso_file_path }}"