Browse Source

Merge branch 'devel' into devel

Lucas A. Wilson 4 years ago
parent
commit
189bc4a0fc
30 changed files with 517 additions and 235 deletions
  1. 11 4
      appliance/appliance_config.yml
  2. 37 4
      appliance/roles/common/tasks/password_config.yml
  3. 3 0
      appliance/roles/common/vars/main.yml
  4. 16 3
      appliance/roles/inventory/files/create_inventory.yml
  5. 10 5
      appliance/roles/inventory/tasks/main.yml
  6. 20 14
      appliance/roles/provision/tasks/check_prerequisites.yml
  7. 1 1
      appliance/roles/provision/tasks/configure_cobbler.yml
  8. 2 2
      appliance/roles/provision/tasks/main.yml
  9. 96 14
      appliance/roles/provision/tasks/mapping_file.yml
  10. 1 1
      appliance/roles/provision/tasks/mount_iso.yml
  11. 2 0
      appliance/roles/provision/tasks/provision_password.yml
  12. 6 3
      appliance/roles/provision/vars/main.yml
  13. 11 4
      appliance/test/appliance_config_empty.yml
  14. 12 5
      appliance/test/appliance_config_test.yml
  15. 45 34
      appliance/test/test_common.yml
  16. 2 0
      appliance/test/test_mapping_file
  17. 2 55
      appliance/test/test_provision_cc.yml
  18. 3 0
      appliance/test/test_vars/test_common_vars.yml
  19. 0 25
      appliance/tools/provision_host_report.j2
  20. 40 42
      appliance/tools/provision_report.yml
  21. 6 0
      appliance/tools/roles/cluster_preperation/tasks/passwordless_ssh.yml
  22. 3 1
      appliance/tools/roles/fetch_password/tasks/main.yml
  23. 91 0
      appliance/tools/roles/hpc_cluster_report/tasks/main.yml
  24. 38 0
      appliance/tools/roles/hpc_cluster_report/templates/provision_host_report.j2
  25. 2 0
      examples/mapping_file.csv
  26. 5 1
      omnia.yml
  27. 1 1
      roles/cluster_validation/tasks/fetch_password.yml
  28. 19 1
      roles/cluster_validation/tasks/main.yml
  29. 17 7
      roles/k8s_start_manager/tasks/main.yml
  30. 15 8
      roles/k8s_start_workers/tasks/main.yml

+ 11 - 4
appliance/appliance_config.yml

@@ -32,11 +32,18 @@ hpc_nic: "em1"
 # Default value of nic is em2
 # Default value of nic is em2
 public_nic: "em2"
 public_nic: "em2"
 
 
+# This is the  path where user has kept the iso image that needs to be provisioned in target nodes.
+# The iso file should be CentOS7-2009-minimal edition.
+# Other iso file not supported.
+iso_file_path: "" 
+
 # The mapping file consists of the MAC address and its respective IP address and hostname.
 # The mapping file consists of the MAC address and its respective IP address and hostname.
-# If user wants to provide a mapping file, set this value to "true"
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
-mapping_file_exists: ""
+# A template for mapping file exists in omnia/examples and is named as mapping_file.csv.
+# This depicts the path where user has kept the mapping file for DHCP configurations.
+mapping_file_path: ""
 
 
-# The dhcp range for assigning the IP address to the baremetal nodes.
+# The dhcp range for assigning the IPv4 address to the baremetal nodes.
+# Example: 10.1.23.1
 dhcp_start_ip_range: ""
 dhcp_start_ip_range: ""
-dhcp_end_ip_range: ""
+dhcp_end_ip_range: ""

+ 37 - 4
appliance/roles/common/tasks/password_config.yml

@@ -38,6 +38,7 @@
       awx_password | length < 1 or
       awx_password | length < 1 or
       hpc_nic | length < 1 or
       hpc_nic | length < 1 or
       public_nic | length < 1 or
       public_nic | length < 1 or
+      iso_file_path | length < 1 or
       dhcp_start_ip_range | length < 1 or
       dhcp_start_ip_range | length < 1 or
       dhcp_end_ip_range | length < 1
       dhcp_end_ip_range | length < 1
 
 
@@ -47,9 +48,11 @@
     admin_password: "{{ awx_password }}"
     admin_password: "{{ awx_password }}"
     nic:  "{{ hpc_nic }}"
     nic:  "{{ hpc_nic }}"
     internet_nic: "{{ public_nic }}"
     internet_nic: "{{ public_nic }}"
+    path_for_iso_file: "{{ iso_file_path }}"
     dhcp_start_ip: "{{ dhcp_start_ip_range | ipv4 }}"
     dhcp_start_ip: "{{ dhcp_start_ip_range | ipv4 }}"
     dhcp_end_ip: "{{ dhcp_end_ip_range | ipv4 }}"
     dhcp_end_ip: "{{ dhcp_end_ip_range | ipv4 }}"
-    mapping_file: "{{ mapping_file_exists }}"
+    mapping_file: false
+    path_for_mapping_file: "{{ mapping_file_path }}"
   no_log: true
   no_log: true
 
 
 - name: Get the system hpc ip
 - name: Get the system hpc ip
@@ -153,10 +156,40 @@
 - name: Assert mapping_file_exists
 - name: Assert mapping_file_exists
   assert:
   assert:
     that:
     that:
-      - "( mapping_file == true) or ( mapping_file == false)"
+      - "( mapping_file == true ) or ( mapping_file == false )"
     success_msg: "{{ success_mapping_file }}"
     success_msg: "{{ success_mapping_file }}"
     fail_msg: "{{ fail_mapping_file }}"
     fail_msg: "{{ fail_mapping_file }}"
-  register: mapping_file_check
+
+- name: Set the mapping file value
+  set_fact:
+    mapping_file: true
+  when: path_for_mapping_file != ""
+  
+- name: Assert valid mapping_file_path
+  stat: 
+    path: "{{ path_for_mapping_file }}"
+  when: mapping_file == true
+  register: result_path_mapping_file
+  
+- name : Valid mapping_file_path
+  fail:
+    msg: "{{ invalid_mapping_file_path }}"
+  when: ( mapping_file == true ) and ( result_path_mapping_file.stat.exists == false )
+
+- name: Assert valid iso_file_path
+  stat:
+    path: "{{ path_for_iso_file }}"
+  register: result_path_iso_file
+
+- name : Incorrect iso_file_path
+  fail:
+    msg: "{{ invalid_iso_file_path }}"
+  when: ( result_path_iso_file.stat.exists == false ) and ( ".iso" not in  path_for_iso_file )
+
+- name: Fail when iso path valid but image not right
+  fail:
+    msg: "{{ invalid_iso_file_path }}"
+  when: ( result_path_iso_file.stat.exists == true ) and ( ".iso" not in path_for_iso_file )
 
 
 - name: Check the subnet of dhcp start range
 - name: Check the subnet of dhcp start range
   shell: |
   shell: |
@@ -301,4 +334,4 @@
   command: >-
   command: >-
     ansible-vault encrypt {{ role_path }}/../../../{{ config_filename }}
     ansible-vault encrypt {{ role_path }}/../../../{{ config_filename }}
     --vault-password-file {{ role_path }}/../../../{{ config_vaultname }}
     --vault-password-file {{ role_path }}/../../../{{ config_vaultname }}
-  changed_when: false
+  changed_when: false

+ 3 - 0
appliance/roles/common/vars/main.yml

@@ -76,6 +76,9 @@ success_dhcp_range: "Dhcp_range validated"
 fail_dhcp_range: "Failed. Incorrect range assigned for dhcp"
 fail_dhcp_range: "Failed. Incorrect range assigned for dhcp"
 success_hpc_ip: "IP validated"
 success_hpc_ip: "IP validated"
 fail_hpc_ip: "Failed. Nic should be configured"
 fail_hpc_ip: "Failed. Nic should be configured"
+fail_mapping_file_path: "Failed. Mapping_file_path input is empty in appliance_config.yml. Either set mapping_file_exists to false or provide a path for a valid mapping file."
+invalid_mapping_file_path: "Incorrect mapping_file_path provided in appliance_config.yml"
+invalid_iso_file_path: "Incorrect iso_file_path provided in appliance_config.yml."
 min_length: 8
 min_length: 8
 max_length: 30
 max_length: 30
 nic_min_length: 3
 nic_min_length: 3

+ 16 - 3
appliance/roles/inventory/files/create_inventory.yml

@@ -88,14 +88,18 @@
     - name: Set the hostname from mapping file
     - name: Set the hostname from mapping file
       hostname:
       hostname:
         name: "{{ host_name.stdout }}"
         name: "{{ host_name.stdout }}"
-      register: result_host_name
       when: ('localhost' in hostname_check.stdout) and (mapping_file_present != "" ) and  (mapping_file | bool == true )
       when: ('localhost' in hostname_check.stdout) and (mapping_file_present != "" ) and  (mapping_file | bool == true )
       ignore_errors: true
       ignore_errors: true
+    
+    - name: Set the hostname if hostname not present mapping file
+      hostname:
+        name: "compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}"
+      when: ('localhost' in hostname_check.stdout) and (file_present.rc != 0) and (mapping_file | bool == true )
+      ignore_errors: true
 
 
     - name: Set the system hostname
     - name: Set the system hostname
       hostname:
       hostname:
         name: "compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}"
         name: "compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}"
-      register: result_name
       when: ('localhost' in hostname_check.stdout) and (mapping_file | bool == false)
       when: ('localhost' in hostname_check.stdout) and (mapping_file | bool == false)
       ignore_errors: true
       ignore_errors: true
 
 
@@ -108,11 +112,20 @@
       when: ('localhost' in hostname_check.stdout) and ( mapping_file_present != "" ) and ( mapping_file | bool == true )
       when: ('localhost' in hostname_check.stdout) and ( mapping_file_present != "" ) and ( mapping_file | bool == true )
       ignore_errors: true
       ignore_errors: true
 
 
+    - name: Add new hostname to /etc/hosts if hostname not present mapping fil
+      lineinfile:
+        dest: /etc/hosts
+        regexp: '^127\.0\.0\.1[ \t]+localhost'
+        line: "127.0.0.1 localhost compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}"
+        state: present
+      when: ('localhost' in hostname_check.stdout) and ( file_present.rc != 0 ) and ( mapping_file | bool == true )
+      ignore_errors: true
+
     - name: Add new hostname to /etc/hosts
     - name: Add new hostname to /etc/hosts
       lineinfile:
       lineinfile:
         dest: /etc/hosts
         dest: /etc/hosts
         regexp: '^127\.0\.0\.1[ \t]+localhost'
         regexp: '^127\.0\.0\.1[ \t]+localhost'
-        line: "127.0.0.1 localhost 'compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}'"
+        line: "127.0.0.1 localhost compute{{ inventory_hostname.split('.')[-2] + '-' + inventory_hostname.split('.')[-1] }}"
         state: present
         state: present
       when: ('localhost' in hostname_check.stdout) and (mapping_file | bool == false )
       when: ('localhost' in hostname_check.stdout) and (mapping_file | bool == false )
       ignore_errors: true
       ignore_errors: true

+ 10 - 5
appliance/roles/inventory/tasks/main.yml

@@ -49,9 +49,15 @@
     - name: Save input variables from file
     - name: Save input variables from file
       set_fact:
       set_fact:
         cobbler_password: "{{ provision_password }}"
         cobbler_password: "{{ provision_password }}"
-        mapping_file: "{{ mapping_file_exists }}"
+        mapping_file: false
+        path_mapping_file: "{{ mapping_file_path }}"
       no_log: True
       no_log: True
 
 
+    - name: Check the status for mapping file
+      set_fact:
+        mapping_file: true
+      when: path_mapping_file != ""
+
     - name: Encrypt input config file
     - name: Encrypt input config file
       command: >-
       command: >-
         ansible-vault encrypt {{ input_config_filename }}
         ansible-vault encrypt {{ input_config_filename }}
@@ -59,11 +65,11 @@
       changed_when: false
       changed_when: false
 
 
     - name: Check if inventory file already exists
     - name: Check if inventory file already exists
-      stat:
+      file:
         path: "/root/inventory"
         path: "/root/inventory"
-      register: stat_result
+        state: absent
 
 
-    - name: Create inventory file if doesnt exist
+    - name: Create empty inventory file
       copy:
       copy:
         dest:  "/root/inventory"
         dest:  "/root/inventory"
         content: |
         content: |
@@ -72,7 +78,6 @@
             hosts:
             hosts:
         owner: root
         owner: root
         mode: 0775
         mode: 0775
-      when: not stat_result.stat.exists
 
 
     - name: Add inventory playbook
     - name: Add inventory playbook
       block:
       block:

+ 20 - 14
appliance/roles/provision/tasks/check_prerequisites.yml

@@ -13,26 +13,32 @@
 # limitations under the License.
 # limitations under the License.
 ---
 ---
 
 
-- name: Check availability of iso file
-  stat:
-    path: "{{ role_path }}/files/{{ iso_name }}"
-  register: iso_status
-  tags: install
-
-- name: Iso file not present
-  fail:
-    msg: "{{ iso_fail }}"
-  when: iso_status.stat.exists == false
-  register: iso_file_check
-  tags: install
-
 - name: Initialize variables
 - name: Initialize variables
   set_fact:
   set_fact:
     cobbler_container_status: false
     cobbler_container_status: false
     cobbler_image_status: false
     cobbler_image_status: false
     cobbler_config_status: false
     cobbler_config_status: false
+    backup_map_status: false
+    new_node_status: false
   tags: install
   tags: install
 
 
+- name: Check if any backup file exists
+  block:
+  - name: Check status of backup file
+    stat:
+      path: "{{ role_path }}/files/backup_mapping_file.csv"
+    register: backup_map
+
+  - name: Set status for backup file
+    set_fact:
+      backup_map_status: true
+    when: backup_map.stat.exists == true  
+  rescue:
+  - name: Message
+    debug:
+      msg: "All nodes are new"
+      verbosity: 2
+
 - name: Inspect the cobbler image
 - name: Inspect the cobbler image
   docker_image_info:
   docker_image_info:
     name: cobbler
     name: cobbler
@@ -78,4 +84,4 @@
     - cobbler_container_status == true
     - cobbler_container_status == true
     - "'CentOS' in cobbler_profile_list.stdout"
     - "'CentOS' in cobbler_profile_list.stdout"
     - "'* * * * * ansible-playbook /root/tftp.yml' in crontab_list.stdout"
     - "'* * * * * ansible-playbook /root/tftp.yml' in crontab_list.stdout"
-    - "'5 * * * * ansible-playbook /root/inventory_creation.yml' in crontab_list.stdout"
+    - "'5 * * * * ansible-playbook /root/inventory_creation.yml' in crontab_list.stdout"

+ 1 - 1
appliance/roles/provision/tasks/configure_cobbler.yml

@@ -53,4 +53,4 @@
     - "{{ role_path }}/files/dhcp.template"
     - "{{ role_path }}/files/dhcp.template"
     - "{{ role_path }}/files/settings"
     - "{{ role_path }}/files/settings"
     - "{{ role_path }}/files/centos7.ks"
     - "{{ role_path }}/files/centos7.ks"
-    - "{{ role_path }}/files/new_mapping_file.csv.bak"
+    - "{{ role_path }}/files/new_mapping_file.csv.bak"

+ 2 - 2
appliance/roles/provision/tasks/main.yml

@@ -40,11 +40,11 @@
 
 
 - name: Dhcp Configuration
 - name: Dhcp Configuration
   import_tasks: dhcp_configure.yml
   import_tasks: dhcp_configure.yml
-  when: not cobbler_image_status
+  when: (not cobbler_image_status) or ( backup_map_status == true)
 
 
 - name: Mapping file validation
 - name: Mapping file validation
   import_tasks: mapping_file.yml
   import_tasks: mapping_file.yml
-  when: (not cobbler_image_status) and (mapping_file == true)
+  when: (not cobbler_image_status) and (mapping_file == true) or ( backup_map_status == true)
 
 
 - name: Cobbler image creation
 - name: Cobbler image creation
   import_tasks: cobbler_image.yml
   import_tasks: cobbler_image.yml

+ 96 - 14
appliance/roles/provision/tasks/mapping_file.yml

@@ -9,25 +9,24 @@
 # Unless required by applicable law or agreed to in writing, software
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # 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.
 # limitations under the License.
 ---
 ---
 
 
-- name: Check availability of mapping file
-  stat:
-    path: "{{ role_path }}/files/{{ mapping_file_name }}"
-  register: mapping_file_status
+- name: Check if file is comma seperated
+  shell: awk -F\, '{print NF-1}' {{ path_for_mapping_file }}
+  register: comma_seperated
+  changed_when: false
   tags: install
   tags: install
 
 
-- name: Mapping file not present
+- name: Fail if not comma seperated
   fail:
   fail:
-    msg: "{{ mapping_file_fail }}"
-  when: mapping_file_status.stat.exists == false
-  register: mapping_file_check
+    msg: "{{ not_comma_seperated }}"
+  when: item != "2"
+  with_items: "{{ comma_seperated.stdout_lines }}"
   tags: install
   tags: install
 
 
 - name: Remove blank lines
 - name: Remove blank lines
-  shell:  awk -F, 'length>NF+1' {{ role_path }}/files/{{ mapping_file_name }} > {{ role_path }}/files/new_mapping_file.csv
+  shell:  awk -F, 'length>NF+1' {{ path_for_mapping_file }} > {{ role_path }}/files/new_mapping_file.csv
   changed_when: false
   changed_when: false
   tags: install
   tags: install
 
 
@@ -38,22 +37,69 @@
   changed_when: false
   changed_when: false
   tags: install
   tags: install
 
 
-- name: Count the rows
+- name: Check if header present
+  shell:  awk 'NR==1 { print $1}' {{ role_path }}/files/new_mapping_file.csv
+  register: header
+  changed_when: false
+  tags: install
+
+- name: Fail if header not present
+  fail:
+    msg: "{{ header_fail }}"
+  when: header.stdout !=  valid_header
+
+- name: Count the hostname
   shell: awk -F',' '{print $2}' {{ role_path }}/files/new_mapping_file.csv | wc -l
   shell: awk -F',' '{print $2}' {{ role_path }}/files/new_mapping_file.csv | wc -l
-  register: total_count
+  register: total_hostname
+  changed_when: false
+  tags: install
+
+- name: Count the ip
+  shell: awk -F',' '{print $3}' {{ role_path }}/files/new_mapping_file.csv | wc -l
+  register: total_ip
+  changed_when: false
+  tags: install
+
+- name: Count the macs
+  shell: awk -F',' '{print $1}' {{ role_path }}/files/new_mapping_file.csv | wc -l
+  register: total_mac
   changed_when: false
   changed_when: false
   tags: install
   tags: install
 
 
 - name: Check for duplicate hostname
 - name: Check for duplicate hostname
   shell: awk -F',' '{print $2}' {{ role_path }}/files/new_mapping_file.csv | uniq | wc -l
   shell: awk -F',' '{print $2}' {{ role_path }}/files/new_mapping_file.csv | uniq | wc -l
-  register: count_host
+  register: uniq_hostname
+  changed_when: false
+  tags: install
+
+- name: Check for duplicate ip
+  shell: awk -F',' '{print $3}' {{ role_path }}/files/new_mapping_file.csv | uniq | wc -l
+  register: uniq_ip
+  changed_when: false
+  tags: install
+
+- name: Check for duplicate mac
+  shell: awk -F',' '{print $1}' {{ role_path }}/files/new_mapping_file.csv | uniq | wc -l
+  register: uniq_mac
   changed_when: false
   changed_when: false
   tags: install
   tags: install
 
 
 - name: Fail if duplicate hosts exist
 - name: Fail if duplicate hosts exist
   fail:
   fail:
     msg: "{{ fail_hostname_duplicate }}"
     msg: "{{ fail_hostname_duplicate }}"
-  when:  total_count.stdout >  count_host.stdout
+  when:  total_hostname.stdout >  uniq_hostname.stdout
+  tags: install
+
+- name: Fail if duplicate ips exist
+  fail:
+    msg: "{{ fail_ip_duplicate }}"
+  when:  total_ip.stdout >  uniq_ip.stdout
+  tags: install
+
+- name: Fail if duplicate mac exist
+  fail:
+    msg: "{{ fail_mac_duplicate }}"
+  when:  total_mac.stdout >  uniq_mac.stdout
   tags: install
   tags: install
 
 
 - name: Check if _ or . or space present in hostname
 - name: Check if _ or . or space present in hostname
@@ -69,6 +115,23 @@
   when: hostname_result.stdout != ""
   when: hostname_result.stdout != ""
   tags: install
   tags: install
 
 
+- name: Compare the file for new nodes
+  block:
+  - name: difference
+    shell: diff {{ role_path }}/files/new_mapping_file.csv {{role_path}}/files/backup_mapping_file.csv| tr -d \>|tr -d \<| grep -E -- ', & :| '
+    register: diff_output
+    when: backup_map_status == true
+
+  - name: status of new nodes
+    set_fact:
+      new_node_status: true
+    when: diff_output.stdout!= ""
+  rescue:
+  - name: No new nodes
+    debug:
+      msg: "No new nodes to add"
+      verbosity: 2
+
 - name: Fetch input
 - name: Fetch input
   blockinfile:
   blockinfile:
     path: "{{ role_path }}/files/dhcp.template"
     path: "{{ role_path }}/files/dhcp.template"
@@ -81,4 +144,23 @@
     marker: "# {mark} DHCP BLOCK OF {{ item.split(',')[0] }}"
     marker: "# {mark} DHCP BLOCK OF {{ item.split(',')[0] }}"
   with_lines: "{{ remove_header }}"
   with_lines: "{{ remove_header }}"
   ignore_errors: true
   ignore_errors: true
+  when: (not cobbler_image_status) or (new_node_status == true)
   tags: install
   tags: install
+
+- name: Create a backup file
+  copy:
+    src: "{{ role_path }}/files/new_mapping_file.csv"
+    dest: "{{ role_path }}/files/backup_mapping_file.csv"
+
+- name: Copy the dhcp.template inside container
+  command: docker exec cobbler cp /root/omnia/appliance/roles/provision/files/dhcp.template /etc/cobbler/dhcp.template
+  when:  ( cobbler_container_status == true ) and ( new_node_status == true )
+
+- name: Cobbler sync for adding new nodes
+  command: docker exec cobbler cobbler sync
+  when:  ( cobbler_container_status == true ) and ( new_node_status == true )
+
+- name: Restart dhcpd
+  command: docker exec cobbler systemctl restart dhcpd
+  when:  ( cobbler_container_status == true ) and ( new_node_status == true )
+

+ 1 - 1
appliance/roles/provision/tasks/mount_iso.yml

@@ -36,7 +36,7 @@
   tags: install
   tags: install
 
 
 - name: Mount the iso file
 - name: Mount the iso file
-  command: mount -o loop {{ role_path }}/files/{{ iso_name }} /mnt/{{ iso_path }}
+  command: mount -o loop {{ path_for_iso_file }} /mnt/{{ iso_path }}
   changed_when: false
   changed_when: false
   args:
   args:
     warn: no
     warn: no

+ 2 - 0
appliance/roles/provision/tasks/provision_password.yml

@@ -58,11 +58,13 @@
   changed_when: false
   changed_when: false
   register: prompt_random_phrase
   register: prompt_random_phrase
   tags: install
   tags: install
+  no_log: true
 
 
 - name: Set random phrase
 - name: Set random phrase
   set_fact:
   set_fact:
     random_phrase: "{{ prompt_random_phrase.stdout }}"
     random_phrase: "{{ prompt_random_phrase.stdout }}"
   tags: install
   tags: install
+  no_log: true
 
 
 - name: Login password
 - name: Login password
   command: openssl passwd -1 -salt {{ random_phrase }} {{ cobbler_password }}
   command: openssl passwd -1 -salt {{ random_phrase }} {{ cobbler_password }}

+ 6 - 3
appliance/roles/provision/vars/main.yml

@@ -16,10 +16,13 @@
 # vars file for provision
 # vars file for provision
 
 
 #Usage: mapping_file.yml
 #Usage: mapping_file.yml
-mapping_file_name: mapping_file.csv
-mapping_file_fail: "Mapping file not found. Copy the mapping_file.csv to omnia/appliance/roles/provision/files"
-fail_hostname_duplicate:  "Duplicate hostname exists. Please verify mapping file again."
+fail_hostname_duplicate:  "Failed: Duplicate hostname exists. Please verify mapping file again."
 remove_header: awk 'NR > 1 { print }' {{ role_path }}/files/new_mapping_file.csv
 remove_header: awk 'NR > 1 { print }' {{ role_path }}/files/new_mapping_file.csv
+fail_ip_duplicate:  "Failed: Duplicate ip exists. Please verify mapping file again."
+fail_mac_duplicate:  "Failed: Duplicate mac exists. Please verify mapping file again."
+header_fail: "Failed: Header (MAC,Hostname,IP) should be present in the mapping file"
+valid_header: MAC,Hostname,IP
+not_comma_seperated: "Failed: Mapping file should be comma seperated." 
 
 
 #Usage: check_prerequisite.yml
 #Usage: check_prerequisite.yml
 iso_name: CentOS-7-x86_64-Minimal-2009.iso
 iso_name: CentOS-7-x86_64-Minimal-2009.iso

+ 11 - 4
appliance/test/appliance_config_empty.yml

@@ -32,11 +32,18 @@ hpc_nic: "em1"
 # Default value of nic is em2
 # Default value of nic is em2
 public_nic: "em2"
 public_nic: "em2"
 
 
+# This is the  path where user has kept the iso image that needs to be provisioned in target nodes.
+# The iso file should be CentOS7-2009-minimal edition.
+# Other iso files are not supported.
+iso_file_path: ""
+
 # The mapping file consists of the MAC address and its respective IP address and hostname.
 # The mapping file consists of the MAC address and its respective IP address and hostname.
-# If user wants to provide a mapping file, set this value to "true"
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
-mapping_file_exists: ""
+# A template for mapping file exists in omnia/examples and is named as mapping_file.csv.
+# This depicts the path where user has kept the mapping file for DHCP configurations.
+mapping_file_path: ""
 
 
-# The dhcp range for assigning the IP address to the baremetal nodes.
+# The dhcp range for assigning the IPv4 address to the baremetal nodes.
+# Example: 10.1.23.1
 dhcp_start_ip_range: ""
 dhcp_start_ip_range: ""
-dhcp_end_ip_range: ""
+dhcp_end_ip_range: ""

+ 12 - 5
appliance/test/appliance_config_test.yml

@@ -32,11 +32,18 @@ hpc_nic: "em1"
 # Default value of nic is em2
 # Default value of nic is em2
 public_nic: "em2"
 public_nic: "em2"
 
 
+# This is the  path where user has kept the iso image that needs to be provisioned in target nodes.
+# The iso file should be CentOS7-2009-minimal edition.
+# Other iso files are not supported.
+iso_file_path: "/root/CentOS-7-x86_64-Minimal-2009.iso"
+
 # The mapping file consists of the MAC address and its respective IP address and hostname.
 # The mapping file consists of the MAC address and its respective IP address and hostname.
-# If user wants to provide a mapping file, set this value to "true"
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
 # The format of mapping file should be MAC,hostname,IP and must be a CSV file.
-mapping_file_exists: "false"
+# A template for mapping file exists in omnia/examples and is named as mapping_file.csv.
+# This depicts the path where user has kept the mapping file for DHCP configurations.
+mapping_file_path: ""
 
 
-# The dhcp range for assigning the IP address to the baremetal nodes.
-dhcp_start_ip_range: "172.17.0.20"
-dhcp_end_ip_range: "172.17.0.100"
+# The dhcp range for assigning the IPv4 address to the baremetal nodes.
+# Example: 10.1.23.1
+dhcp_start_ip_range: "172.17.0.10"
+dhcp_end_ip_range: "172.17.0.100"

+ 45 - 34
appliance/test/test_common.yml

@@ -361,7 +361,7 @@
         replace: "{{ item.replace }}"
         replace: "{{ item.replace }}"
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_008
       tags: TC_008
@@ -417,7 +417,7 @@
         replace: "{{ item.replace }}"
         replace: "{{ item.replace }}"
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_009
       tags: TC_009
@@ -444,7 +444,7 @@
       tags: TC_009
       tags: TC_009
 
 
 # Testcase OMNIA_DIO_US_DVC_TC_010
 # Testcase OMNIA_DIO_US_DVC_TC_010
-# Execute common role in management station with mapping_file_exists as empty
+# Execute common role in management station with iso_file_path as empty
 - name: OMNIA_DIO_US_DVC_TC_010
 - name: OMNIA_DIO_US_DVC_TC_010
   hosts: localhost
   hosts: localhost
   connection: local
   connection: local
@@ -488,7 +488,7 @@
       rescue:
       rescue:
         - name: Validate error
         - name: Validate error
           assert:
           assert:
-            that: fail_mapping_file in mapping_file_check.msg
+            that: input_config_failure_msg in input_config_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_010
       tags: TC_010
@@ -530,7 +530,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ long_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ long_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_011
       tags: TC_011
@@ -587,7 +587,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ white_space_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ white_space_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_012
       tags: TC_012
@@ -644,7 +644,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_013
       tags: TC_013
@@ -701,7 +701,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_014
       tags: TC_014
@@ -758,7 +758,7 @@
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ long_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ long_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_015
       tags: TC_015
@@ -815,7 +815,7 @@
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ white_space_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ white_space_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_016
       tags: TC_016
@@ -872,7 +872,7 @@
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_017
       tags: TC_017
@@ -929,7 +929,7 @@
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_018
       tags: TC_018
@@ -956,7 +956,7 @@
       tags: TC_018
       tags: TC_018
 
 
 # Testcase OMNIA_DIO_US_DVC_TC_019
 # Testcase OMNIA_DIO_US_DVC_TC_019
-# Execute common role in management station with mapping_file_exists status as true
+# Execute common role in management station with valid iso_file_path
 - name: OMNIA_DIO_US_DVC_TC_019
 - name: OMNIA_DIO_US_DVC_TC_019
   hosts: localhost
   hosts: localhost
   connection: local
   connection: local
@@ -986,7 +986,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"true\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_019
       tags: TC_019
@@ -1001,7 +1001,7 @@
       always:
       always:
         - name: Validate success message
         - name: Validate success message
           assert:
           assert:
-            that: success_mapping_file in mapping_file_check.msg
+            that: result_path_iso_file.stat.exists == true
             success_msg: "{{ input_config_check_success_msg }}"
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_019
       tags: TC_019
@@ -1013,7 +1013,7 @@
       tags: TC_019
       tags: TC_019
 
 
 # Testcase OMNIA_DIO_US_DVC_TC_020
 # Testcase OMNIA_DIO_US_DVC_TC_020
-# Execute common role in management station with mapping_file_exists status other than true or false
+# Execute common role in management station with wrong iso_file_path
 - name: OMNIA_DIO_US_DVC_TC_020
 - name: OMNIA_DIO_US_DVC_TC_020
   hosts: localhost
   hosts: localhost
   connection: local
   connection: local
@@ -1043,7 +1043,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"test\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ wrong_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_020
       tags: TC_020
@@ -1056,9 +1056,14 @@
           vars:
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
             input_config_filename: "{{ new_input_config_filename }}"
       rescue:
       rescue:
+        - name: Check log file
+          command: tail /var/log/omnia.log
+          register: iso_fail_log_check
+          changed_when: false
+            
         - name: Validate error
         - name: Validate error
           assert:
           assert:
-            that: fail_mapping_file in mapping_file_check.msg
+            that: invalid_iso_file_path in iso_fail_log_check.stdout
             success_msg: "{{ input_config_check_success_msg }}"
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_020
       tags: TC_020
@@ -1100,7 +1105,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_021
       tags: TC_021
 
 
@@ -1156,7 +1161,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
       tags: TC_022
       tags: TC_022
 
 
@@ -1182,7 +1187,7 @@
       tags: TC_022
       tags: TC_022
 
 
 # Testcase OMNIA_DIO_US_DVC_TC_023
 # Testcase OMNIA_DIO_US_DVC_TC_023
-# Execute common role in management station with mapping_file_exists status as false
+# Execute common role in management station with mapping_file_path provided
 - name: OMNIA_DIO_US_DVC_TC_023
 - name: OMNIA_DIO_US_DVC_TC_023
   hosts: localhost
   hosts: localhost
   connection: local
   connection: local
@@ -1212,7 +1217,8 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
+        - { regexp: "mapping_file_path: \"\"", replace: "mapping_file_path: \"{{ valid_mapping_file_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_023
       tags: TC_023
@@ -1225,9 +1231,14 @@
           vars:
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
             input_config_filename: "{{ new_input_config_filename }}"
       always:
       always:
+        - name: Check log file
+          command: tail -100 /var/log/omnia.log
+          register: mapping_success_log_check
+          changed_when: false
+          
         - name: Validate success message
         - name: Validate success message
           assert:
           assert:
-            that: success_mapping_file in mapping_file_check.msg
+            that: success_mapping_file in mapping_success_log_check.stdout
             success_msg: "{{ input_config_check_success_msg }}"
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_023
       tags: TC_023
@@ -1269,7 +1280,7 @@
       with_items:
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ max_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ max_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_024
       tags: TC_024
@@ -1326,7 +1337,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ max_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ max_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_025
       tags: TC_025
@@ -1383,7 +1394,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em2\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em2\"" }
@@ -1441,7 +1452,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"\"" }
@@ -1499,7 +1510,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"\"" }
@@ -1557,7 +1568,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"em5\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"em5\"" }
@@ -1615,7 +1626,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em5\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em5\"" }
@@ -1673,7 +1684,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ invalid_dhcp_ip }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ invalid_dhcp_ip }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_031
       tags: TC_031
@@ -1730,7 +1741,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ wrong_dhcp_ip }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ wrong_dhcp_ip }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_032
       tags: TC_032
@@ -1787,7 +1798,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ wrong_dhcp_ip }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ wrong_dhcp_ip }}\"" }
       tags: TC_033
       tags: TC_033
@@ -1844,7 +1855,7 @@
       with_items:
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ invalid_dhcp_ip }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ invalid_dhcp_ip }}\"" }
       tags: TC_034
       tags: TC_034

+ 2 - 0
appliance/test/test_mapping_file

@@ -0,0 +1,2 @@
+Mac,Hostname,IP
+xx:yy:zz:aa:bb,validation-host21,172.20.0.21

+ 2 - 55
appliance/test/test_provision_cc.yml

@@ -21,10 +21,11 @@
   vars_files:
   vars_files:
     - test_vars/test_provision_vars.yml
     - test_vars/test_provision_vars.yml
     - ../roles/provision/vars/main.yml
     - ../roles/provision/vars/main.yml
+    - "{{ test_input_config_filename }}"
   tasks:
   tasks:
     - name: Check the iso file is present
     - name: Check the iso file is present
       stat:
       stat:
-        path: "{{ iso_file_path }}/{{ iso_name }}"
+        path: "{{ iso_file_path }}"
       register: iso_status
       register: iso_status
       tags: TC_004
       tags: TC_004
 
 
@@ -605,57 +606,3 @@
         fail_msg: "{{ cobbler_reboot_fail_msg }}"
         fail_msg: "{{ cobbler_reboot_fail_msg }}"
         success_msg: "{{ cobbler_reboot_success_msg }}"
         success_msg: "{{ cobbler_reboot_success_msg }}"
       tags: TC_007,VERIFY_007
       tags: TC_007,VERIFY_007
-
-# Testcase OMNIA_DIO_US_CC_TC_008
-# Execute provison role in management station with centos iso file not present in files folder of provision role
-- name: OMNIA_DIO_US_CC_TC_008
-  hosts: localhost
-  connection: local
-  vars_files:
-    - test_vars/test_provision_vars.yml
-    - ../roles/provision/vars/main.yml
-  tasks:
-    - name: Check the iso file is present
-      stat:
-        path: "{{ iso_file_path }}/{{ iso_name }}"
-      register: iso_status
-      tags: TC_008
-
-    - name: Copy iso file to different name
-      copy:
-        src: "{{ iso_file_path }}/{{ iso_name }}"
-        dest: "{{ iso_file_path }}/{{ temp_iso_name }}"
-      when: iso_status.stat.exists == true
-      tags: TC_008
-
-    - name: Delete iso file
-      file:
-        path: "{{ iso_file_path }}/{{ iso_name }}"
-        state: "absent"
-      when: iso_status.stat.exists == true
-      tags: TC_008
-
-    - block:
-        - name: Call common role
-          include_role:
-            name: ../roles/common
-          vars:
-            input_config_filename: "{{ test_input_config_filename }}"
-
-        - name: Call provision role
-          include_role:
-            name: ../roles/provision
-      rescue:
-        - name: Validate iso missing error
-          assert:
-            that: iso_fail in iso_file_check.msg
-            success_msg: "{{ iso_check_success_msg }}"
-            fail_msg: "{{ iso_check_fail_msg }}"
-      tags: TC_008
-
-    - name: Copy iso file to old name
-      copy:
-        src: "{{ iso_file_path }}/{{ temp_iso_name }}"
-        dest: "{{ iso_file_path }}/{{ iso_name }}"
-      when: iso_status.stat.exists == true
-      tags: TC_008

+ 3 - 0
appliance/test/test_vars/test_common_vars.yml

@@ -29,6 +29,9 @@ valid_dhcp_start_range: "172.17.0.10"
 valid_dhcp_end_range: "172.17.0.200"
 valid_dhcp_end_range: "172.17.0.200"
 invalid_dhcp_ip: "1720.1700.1000.1000"
 invalid_dhcp_ip: "1720.1700.1000.1000"
 wrong_dhcp_ip: "d6:dh1:dsj:10"
 wrong_dhcp_ip: "d6:dh1:dsj:10"
+valid_iso_path: "/root/CentOS-7-x86_64-Minimal-2009.iso"
+wrong_iso_path: "/root/testfile"
+valid_mapping_file_path: "test_mapping_file"
 
 
 docker_volume_success_msg: "Docker volume omnia-storage exists"
 docker_volume_success_msg: "Docker volume omnia-storage exists"
 docker_volume_fail_msg: "Docker volume omnia-storage does not exist"
 docker_volume_fail_msg: "Docker volume omnia-storage does not exist"

+ 0 - 25
appliance/tools/provision_host_report.j2

@@ -1,25 +0,0 @@
-HPC Cluster
------------
-Reachable Hosts:
-{% if reachable_host_number > 0 %}
-{% for host in groups['reachable'] %}
-{% if reachable_host_number == 1 %}
-  inet={{ host }}, link/ether={{ ethernet_detail_reachable.stdout | replace(';','')}}
-{% elif reachable_host_number > 1 %}
-  inet={{ host }}, link/ether={{ ethernet_detail_reachable.results[loop.index|int - 1].stdout | replace(';','')}}
-{% endif %}
-{% endfor %}
-{% endif %}
-Total reachable hosts: {{ reachable_host_number }}
-
-Unreachable Hosts:
-{% if unreachable_host_number > 0 %}
-{% for host in groups['ungrouped'] %}
-{% if unreachable_host_number == 1 %}
-  inet={{ host }}, link/ether={{ ethernet_detail_unreachable.stdout | replace(';','')}}
-{% elif unreachable_host_number > 1 %}
-  inet={{ host }}, link/ether={{ ethernet_detail_unreachable.results[loop.index|int - 1].stdout | replace(';','')}}
-{% endif %}
-{% endfor %}
-{% endif %}
-Total unreachable hosts: {{ unreachable_host_number }}

+ 40 - 42
appliance/tools/provision_report.yml

@@ -18,7 +18,14 @@
 
 
 # Command to execute: ansible-playbook provision_report.yml -i ../roles/inventory/files/provisioned_hosts.yml
 # Command to execute: ansible-playbook provision_report.yml -i ../roles/inventory/files/provisioned_hosts.yml
 
 
-- name: Find reachable hosts
+- name: Fetch provision_password
+  hosts: localhost
+  connection: local
+  gather_facts: no
+  roles:
+    - fetch_password
+
+- name: Find reachable hosts using ping
   hosts: all
   hosts: all
   gather_facts: false
   gather_facts: false
   ignore_unreachable: true
   ignore_unreachable: true
@@ -31,53 +38,44 @@
       ignore_errors: yes
       ignore_errors: yes
       changed_when: false
       changed_when: false
 
 
+    - name: Refresh ssh keys
+      command: ssh-keygen -R {{ inventory_hostname }}
+      delegate_to: localhost
+      changed_when: false
+
     - name: Group reachable hosts
     - name: Group reachable hosts
       group_by:
       group_by:
         key: "reachable"
         key: "reachable"
       when: "'100% packet loss' not in ping_result.stdout"
       when: "'100% packet loss' not in ping_result.stdout"
 
 
-- name: Display hosts list
-  hosts: localhost
-  connection: local
-  gather_facts: false
+- name: Find reachable hosts using ssh
+  hosts: reachable
+  gather_facts: False
+  ignore_unreachable: true
+  remote_user: "root"
+  vars:
+    ansible_password: "{{ hostvars['127.0.0.1']['cobbler_password'] }}"
+    ansible_become_pass: "{{ hostvars['127.0.0.1']['cobbler_password'] }}"
+    ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
   tasks:
   tasks:
-    - name: Set reachable and unreachable host number
-      set_fact:
-        reachable_host_number: "{{ groups['reachable'] | length}}"
-        unreachable_host_number: "{{ groups['ungrouped'] | length}}"
-
-    - name: Copy dhcpd.leases from cobbler
-      command: docker cp cobbler:/var/lib/dhcpd/dhcpd.leases dhcpd.leases
-      changed_when: true
-
-    - name: Fetch ethernet details of unreachable hosts
-      shell: sed -n '/{{ item }}/,/ethernet/p' dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
-      register: ethernet_detail_unreachable
-      changed_when: false
-      args:
-        warn: no
-      with_items:
-        - "{{ groups['ungrouped'] }}"
-
-    - name: Fetch ethernet details of reachable hosts
-      shell: sed -n '/{{ item }}/,/ethernet/p' dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
-      register: ethernet_detail_reachable
-      changed_when: false
-      args:
-        warn: no
-      with_items:
-        - "{{ groups['reachable'] }}"
+    - name: Check ssh status
+      command: hostname
+      register: ssh_status
+      ignore_errors: yes
 
 
-    - name: Copy host information to file
-      template:
-        src: provision_host_report.j2
-        dest: provision_host_report.txt
+    - name: Group unreachable ssh hosts
+      group_by:
+        key: "unreachable_ssh"
+      when: ssh_status.unreachable is defined and ssh_status.unreachable == true
 
 
-    - name: Read provision host report
-      command: cat provision_host_report.txt
-      register: host_report
-      changed_when: false
+    - name: Group reachable ssh hosts
+      group_by:
+        key: "reachable_ssh"
+      when: (ssh_status.unreachable is defined and ssh_status.unreachable == false) or (ssh_status.rc is defined and ssh_status.rc == 0)
 
 
-    - name: Display provision host report
-      debug:
-        var: host_report.stdout_lines
+- name: Display hosts list
+  hosts: localhost
+  connection: local
+  gather_facts: false
+  roles:
+    - hpc_cluster_report

+ 6 - 0
appliance/tools/roles/cluster_preperation/tasks/passwordless_ssh.yml

@@ -18,6 +18,12 @@
     ssh_status: false
     ssh_status: false
     current_host: "{{ item }}"
     current_host: "{{ item }}"
 
 
+- name: Refresh ssh-key if changed
+  command: ssh-keygen -R {{ current_host }}
+  changed_when: False
+  ignore_errors: yes
+  when: "'manager' in group_names"
+
 - name: Verify whether passwordless ssh is set on the remote host
 - name: Verify whether passwordless ssh is set on the remote host
   command: ssh -o PasswordAuthentication=no root@"{{ current_host }}" 'hostname'
   command: ssh -o PasswordAuthentication=no root@"{{ current_host }}" 'hostname'
   register: ssh_output
   register: ssh_output

+ 3 - 1
appliance/tools/roles/fetch_password/tasks/main.yml

@@ -30,11 +30,13 @@
 
 
 - name: Include variable file appliance_config.yml
 - name: Include variable file appliance_config.yml
   include_vars: "{{ role_path }}/../../../{{ input_config_filename }}"
   include_vars: "{{ role_path }}/../../../{{ input_config_filename }}"
+  no_log: true
 
 
 - name: Save input variables from file
 - name: Save input variables from file
   set_fact:
   set_fact:
     cobbler_password: "{{ provision_password }}"
     cobbler_password: "{{ provision_password }}"
-
+  no_log: true
+  
 - name: Encrypt input config file
 - name: Encrypt input config file
   command: >-
   command: >-
     ansible-vault encrypt {{ role_path }}/../../../{{ input_config_filename }}
     ansible-vault encrypt {{ role_path }}/../../../{{ input_config_filename }}

+ 91 - 0
appliance/tools/roles/hpc_cluster_report/tasks/main.yml

@@ -0,0 +1,91 @@
+# Copyright 2020 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: Initialize reachable and unreachable host number
+  set_fact:
+    reachable_host_number: 0
+    unreachable_host_number: 0
+    unreachable_ssh_host_number: 0
+    unreachable_ping_host_number: 0
+
+- name: Set reachable host number
+  set_fact:
+    reachable_host_number: "{{ groups['reachable_ssh'] | length}}"
+  when: groups['reachable_ssh'] is defined
+
+- name: Set unreachable host number
+  set_fact:
+    unreachable_host_number: "{{ groups['ungrouped'] | length | int + groups['unreachable_ssh'] | length | int }}"
+    unreachable_ssh_host_number: "{{ groups['unreachable_ssh'] | length }}"
+    unreachable_ping_host_number: "{{ groups['ungrouped'] | length }}"
+  when: groups['unreachable_ssh'] is defined
+
+- name: Set unreachable host number
+  set_fact:
+    unreachable_host_number: "{{ groups['ungrouped'] | length }}"
+    unreachable_ping_host_number: "{{ groups['ungrouped'] | length }}"
+  when: groups['unreachable_ssh'] is not defined
+            
+- name: Create files folder
+  file:
+    path: "{{ role_path}}/files"
+    state: directory
+    
+- name: Copy dhcpd.leases from cobbler
+  command: docker cp cobbler:/var/lib/dhcpd/dhcpd.leases {{ role_path}}/files/dhcpd.leases
+  changed_when: true
+
+- name: Fetch ethernet details of unreachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_unreachable_ping
+  changed_when: false
+  args:
+    warn: no
+  with_items:
+    - "{{ groups['ungrouped'] }}"
+
+- name: Fetch ethernet details of unreachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_unreachable_ssh
+  changed_when: false
+  args:
+    warn: no
+  when: groups['unreachable_ssh'] is defined
+  with_items:
+    - "{{ groups['unreachable_ssh'] }}"
+
+- name: Fetch ethernet details of reachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_reachable
+  changed_when: false
+  args:
+    warn: no
+  when: groups['reachable_ssh'] is defined
+  with_items:
+    - "{{ groups['reachable_ssh'] }}"
+
+- name: Copy host information to file
+  template:
+    src: provision_host_report.j2
+    dest: "{{ role_path}}/files/provision_host_report.txt"
+
+- name: Read provision host report
+  command: cat {{ role_path}}/files/provision_host_report.txt
+  register: host_report
+  changed_when: false
+
+- name: Display provision host report
+  debug:
+    var: host_report.stdout_lines

+ 38 - 0
appliance/tools/roles/hpc_cluster_report/templates/provision_host_report.j2

@@ -0,0 +1,38 @@
+HPC Cluster
+-----------
+Reachable Hosts:
+{% if reachable_host_number > 0 %}
+{% for host in groups['reachable_ssh'] %}
+{% if reachable_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.stdout | replace(';','')}}
+{% elif reachable_host_number > 1 %}
+{% if ethernet_detail_reachable.results[loop.index|int - 1].stdout | length > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.results[loop.index|int - 1].stdout | replace(';','')}}
+{% else %}
+  inet={{ host }}, link/ether=Refer to mapping file provided
+{% endif %}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total reachable hosts: {{ reachable_host_number }}
+
+Unreachable Hosts:
+{% if unreachable_ping_host_number > 0 %}
+{% for host in groups['ungrouped'] %}
+{% if unreachable_ping_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ping.stdout | replace(';','')}}
+{% elif unreachable_ping_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ping.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if unreachable_ssh_host_number > 0 %}
+{% for host in groups['unreachable_ssh'] %}
+{% if unreachable_ssh_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ssh.stdout | replace(';','')}}
+{% elif unreachable_ssh_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ssh.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total unreachable hosts: {{ unreachable_host_number }}

+ 2 - 0
examples/mapping_file.csv

@@ -0,0 +1,2 @@
+MAC,Hostname,IP
+xx:yy:zz:aa:bb,server,1.2.3.4

+ 5 - 1
omnia.yml

@@ -123,4 +123,8 @@
   gather_facts: false
   gather_facts: false
   roles:
   roles:
     - slurm_exporter
     - slurm_exporter
-  tags: slurm
+  tags: slurm
+
+- name: Passwordless SSH between manager and compute nodes
+  include: appliance/tools/passwordless_ssh.yml
+  when: hostvars['127.0.0.1']['appliance_status']

+ 1 - 1
roles/cluster_validation/tasks/fetch_password.yml

@@ -84,4 +84,4 @@
   command: >-
   command: >-
     ansible-vault encrypt {{ role_path }}/../../{{ config_filename }}
     ansible-vault encrypt {{ role_path }}/../../{{ config_filename }}
     --vault-password-file {{ role_path }}/../../{{ config_vaultname }}
     --vault-password-file {{ role_path }}/../../{{ config_vaultname }}
-  changed_when: false
+  changed_when: false

+ 19 - 1
roles/cluster_validation/tasks/main.yml

@@ -16,4 +16,22 @@
   include_tasks: validations.yml
   include_tasks: validations.yml
 
 
 - name: Fetch passwords
 - name: Fetch passwords
-  include_tasks: fetch_password.yml
+  include_tasks: fetch_password.yml
+
+- name: Check if omnia is running from AWX
+  block:
+    - name: Appliance status
+      set_fact:
+        appliance_status: false
+
+    - name: Check AWX instance
+      command: awx-manage --version
+
+    - name: Update appliance status
+      set_fact:
+        appliance_status: true
+
+  rescue:
+    - name: Passwordless SSH status
+      debug:
+        msg: "omnia.yml running on host"

+ 17 - 7
roles/k8s_start_manager/tasks/main.yml

@@ -22,17 +22,25 @@
   setup:
   setup:
     filter: ansible_default_ipv4.address
     filter: ansible_default_ipv4.address
 
 
-- name: Reset kubeadm
-  command: kubeadm reset -f
-  changed_when: true
+- name: Get K8s nodes status
+  command: kubectl get nodes
+  changed_when: false
   ignore_errors: True
   ignore_errors: True
+  register: k8s_nodes
   tags: init
   tags: init
 
 
-- name: Check K8s nodes status
-  command: kubectl get nodes
+- name: Get K8s ready compute nodes
+  shell: kubectl get node --selector='!node-role.kubernetes.io/master' | grep -v 'NotReady'
   changed_when: false
   changed_when: false
   ignore_errors: True
   ignore_errors: True
-  register: k8s_nodes
+  register: k8s_nodes_ready
+  tags: init
+
+- name: Get K8s not ready compute nodes
+  shell: kubectl get node --selector='!node-role.kubernetes.io/master' | grep 'NotReady'
+  changed_when: false
+  ignore_errors: True
+  register: k8s_nodes_not_ready
   tags: init
   tags: init
 
 
 - name: Initialize kubeadm
 - name: Initialize kubeadm
@@ -89,6 +97,8 @@
     hash:   "{{ K8S_MANAGER_CA_HASH.stdout }}"
     hash:   "{{ K8S_MANAGER_CA_HASH.stdout }}"
     ip:     "{{ ansible_default_ipv4.address }}"
     ip:     "{{ ansible_default_ipv4.address }}"
     k8s_nodes:  "{{ k8s_nodes.stdout }}"
     k8s_nodes:  "{{ k8s_nodes.stdout }}"
+    k8s_nodes_ready:  "{{ k8s_nodes_ready.stdout }}"
+    k8s_nodes_not_ready: "{{ k8s_nodes_not_ready.stdout }}"
   tags: init
   tags: init
 
 
 - name: Print k8s token
 - name: Print k8s token
@@ -172,4 +182,4 @@
 - name: Edge / Workstation Install allows pods to scheudle on manager
 - name: Edge / Workstation Install allows pods to scheudle on manager
   command: kubectl taint nodes --all node-role.kubernetes.io/master-
   command: kubectl taint nodes --all node-role.kubernetes.io/master-
   when: groups['manager'][0] == groups['compute'][0] and groups['compute']|length == 1
   when: groups['manager'][0] == groups['compute'][0] and groups['compute']|length == 1
-  tags: init
+  tags: init

+ 15 - 8
roles/k8s_start_workers/tasks/main.yml

@@ -18,22 +18,29 @@
   changed_when: true
   changed_when: true
   tags: init
   tags: init
 
 
-- name: Reset kubeadm
-  command: kubeadm reset -f
-  changed_when: true
-  ignore_errors: True
-  tags: init
-
 - name: Get hostname
 - name: Get hostname
   command: hostname
   command: hostname
   changed_when: true
   changed_when: true
   register: node_hostname
   register: node_hostname
   tags: init
   tags: init
 
 
+- name: Reset kubeadm
+  command: kubeadm reset -f
+  changed_when: true
+  ignore_errors: True
+  when:
+    - groups['manager'][0] != groups['compute'][0]
+    - groups['compute']|length >= 1
+    - node_hostname.stdout in hostvars['K8S_TOKEN_HOLDER']['k8s_nodes_not_ready']
+  tags: init
+
 - name: Execute kubeadm join command
 - name: Execute kubeadm join command
   shell: >
   shell: >
     kubeadm join --token={{ hostvars['K8S_TOKEN_HOLDER']['token'] }}
     kubeadm join --token={{ hostvars['K8S_TOKEN_HOLDER']['token'] }}
     --discovery-token-ca-cert-hash sha256:{{ hostvars['K8S_TOKEN_HOLDER']['hash'] }}
     --discovery-token-ca-cert-hash sha256:{{ hostvars['K8S_TOKEN_HOLDER']['hash'] }}
     {{ hostvars['K8S_TOKEN_HOLDER']['ip'] }}:{{ apiserver_bind_port }}
     {{ hostvars['K8S_TOKEN_HOLDER']['ip'] }}:{{ apiserver_bind_port }}
-  when: groups['manager'][0] != groups['compute'][0] and groups['compute']|length >= 1 and node_hostname.stdout not in hostvars['K8S_TOKEN_HOLDER']['k8s_nodes']
-  tags: init
+  when:
+    - groups['manager'][0] != groups['compute'][0]
+    - groups['compute']|length >= 1
+    - node_hostname.stdout not in hostvars['K8S_TOKEN_HOLDER']['k8s_nodes_ready']
+  tags: init