Browse Source

Issue #176: TA - AWX GUI changes dynamic inventory and credentials

Signed-off-by: ptrinesh <palakurthi_trinesh@dellteam.com>
John Lockman 4 years ago
parent
commit
a38432f5a1

+ 891 - 0
appliance/test/test_omnia.yml

@@ -0,0 +1,891 @@
+#  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.
+---
+# Testcase OMNIA_CRM_US_AWXD_TC_006
+# Test case to validate whether the proper error message is displayed when slurm and kubernetes tags are skipped
+- name: OMNIA_CRM_US_AWXD_TC_006
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_006
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_006
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_006
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_006
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_006
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags slurm,kubernetes --monitor -f human
+          changed_when: false
+          register: command_output
+
+      rescue:
+        - name: Validate error message
+          assert:
+            that: "'FAILED!' in command_output.stdout"
+            success_msg: "{{ test_case_success_msg }}"
+            fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_006
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_006
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_006
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_006
+
+# Testcase OMNIA_CRM_US_AWXD_TC_007
+# Test case to validate whether the skip tags validation is passed when slurm tag is given
+- name: OMNIA_CRM_US_AWXD_TC_007
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_007
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_007
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_007
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_007
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_007
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags slurm --monitor -f human
+          changed_when: false
+          register: command_output
+
+    - name: Validate success message
+      assert:
+        that: "'FAILED!' not in command_output.stdout"
+        success_msg: "{{ test_case_success_msg }}"
+        fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_007
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_007
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_007
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_007
+
+# Testcase OMNIA_CRM_US_AWXD_TC_008
+# Test case to validate whether the skip tags validation is passed when kubernetes tag is given
+- name: OMNIA_CRM_US_AWXD_TC_008
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_008
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_008
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_008
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_008
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_008
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags kubernetes --monitor -f human
+          changed_when: false
+          register: command_output
+
+    - name: Validate success message
+      assert:
+        that: "'FAILED!' not in command_output.stdout"
+        success_msg: "{{ test_case_success_msg }}"
+        fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_008
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_008
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_008
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_008
+
+# Testcase OMNIA_CRM_US_AWXD_TC_009
+# Test case to validate whether the proper error message is displayed when no host is added to manager group
+- name: OMNIA_CRM_US_AWXD_TC_009
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_009
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_009
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_009
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_009
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_009
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+      rescue:
+        - name: Validate error message
+          assert:
+            that: "'FAILED!' in command_output.stdout"
+            success_msg: "{{ test_case_success_msg }}"
+            fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_009
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_009
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_009
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_009
+
+# Testcase OMNIA_CRM_US_AWXD_TC_010
+# Test case to verify whether the manger group validation is passed when single host is present
+- name: OMNIA_CRM_US_AWXD_TC_010
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_010
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_010
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_010
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_010
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_010
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+      tags: TC_010
+
+    - name: Validate success message
+      assert:
+        that: "'FAILED!' not in command_output.stdout"
+        success_msg: "{{ test_case_success_msg }}"
+        fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_010
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_010
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_010
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_010
+
+# Testcase OMNIA_CRM_US_AWXD_TC_011
+# Test case to validate whether the proper error message is displayed when no host is added to compute group
+- name: OMNIA_CRM_US_AWXD_TC_011
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_011
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_011
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_011
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host3 }}
+
+          compute:
+            hosts:
+            
+      tags: TC_011
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_011
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+      rescue:
+        - name: Validate error message
+          assert:
+            that: "'FAILED!' in command_output.stdout"
+            success_msg: "{{ test_case_success_msg }}"
+            fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_011
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host3 }} --monitor -f human
+      changed_when: false
+      tags: TC_011
+
+    - name: Delete the inventory file
+      file:
+        state: absent
+        path: testinventory.yml
+      ignore_errors: yes
+      tags: TC_011
+
+    - name: Create inventory file if it doesn't exist
+      file:
+        path: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        state: touch
+      ignore_errors: yes
+      tags: TC_011
+
+# Testcase OMNIA_CRM_US_AWXD_TC_012
+# Test case to verify whether the compute group validation is passed when more than 1 host is present
+- name: OMNIA_CRM_US_AWXD_TC_012
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_012
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_012
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_012
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+            hosts:
+              {{ host3 }}
+      tags: TC_012
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_012
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+    - name: Validate success message
+      assert:
+        that: "'FAILED!' not in command_output.stdout"
+        success_msg: "{{ test_case_success_msg }}"
+        fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_012
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host3 }} --monitor -f human
+      changed_when: false
+      tags: TC_012
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_012
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_012
+
+# Testcase OMNIA_CRM_US_AWXD_TC_013
+# Test case to validate the error meesage when a host is present in both manager and compute groups
+- name: OMNIA_CRM_US_AWXD_TC_013
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_013
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_013
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_013
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host1 }}
+      tags: TC_013
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_013
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+      rescue:
+        - name: Validate error message
+          assert:
+            that: "'FAILED!' in command_output.stdout"
+            success_msg: "{{ test_case_success_msg }}"
+            fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_013
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+      changed_when: false
+      tags: TC_013
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_013
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_013
+
+# Testcase OMNIA_CRM_US_AWXD_TC_014
+# Test case to verify the disjunction validation when the hosts are disjoint
+- name: OMNIA_CRM_US_AWXD_TC_014
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_014
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_014
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_014
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          manager:
+            hosts:
+              {{ host1 }}
+
+          compute:
+            hosts:
+              {{ host2 }}
+      tags: TC_014
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_014
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+    - name: Validate success message
+      assert:
+        that: "'FAILED!' not in command_output.stdout"
+        success_msg: "{{ test_case_success_msg }}"
+        fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_014
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+      changed_when: false
+      tags: TC_014
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_014
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_014
+
+# Testcase OMNIA_CRM_US_AWXD_TC_015
+# Test case to validate whether the proper error message is displayed when more than one host is added to manager group
+- name: OMNIA_CRM_US_AWXD_TC_015
+  hosts: localhost
+  connection: local
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_omnia_vars.yml
+  tasks:
+    - name: Check input config file is encrypted
+      command: cat {{ test_input_config_filename }}
+      changed_when: false
+      register: config_content
+      tags: TC_015
+
+    - name: Decrpyt input_config.yml
+      command: ansible-vault decrypt {{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
+      changed_when: false
+      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
+      tags: TC_015
+
+    - name: Include variable file input_config.yml
+      include_vars: "{{ test_input_config_filename }}"
+      tags: TC_015
+
+    - name: Creating inventory file with hosts associated to the groups
+      copy:
+        dest: "testinventory.yml"
+        mode: '{{ file_permission }}'
+        content: |
+          ---
+          compute:
+            hosts:
+              {{ host1 }}
+
+          manager:
+            hosts:
+              {{ host2 }}
+            hosts:
+              {{ host3 }}
+
+      tags: TC_015
+
+    - name: Push the inventory to AWX
+      shell: |
+        set -o pipefail
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/testinventory.yml"
+      changed_when: false
+      tags: TC_015
+
+    - block:
+        - name: Launch the job template
+          command: >-
+            awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+            job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
+          changed_when: false
+          register: command_output
+
+      rescue:
+        - name: Validate error message
+          assert:
+            that: "'FAILED!' in command_output.stdout"
+            success_msg: "{{ test_case_success_msg }}"
+            fail_msg: "{{ test_case_failure_msg }}"
+      tags: TC_015
+
+    - name: Delete the hosts
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host1 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host2 }} --monitor -f human
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
+        hosts delete {{ host3 }} --monitor -f human
+      changed_when: false
+      tags: TC_015
+
+    - name: Delete the inventory file
+      ignore_errors: yes
+      file:
+        state: absent
+        path: testinventory.yml
+      tags: TC_015
+
+    - name: Create inventory file if it doesn't exist
+      ignore_errors: yes
+      file:
+        path: "testinventory.yml"
+        state: touch
+        mode: '{{ file_permission }}'
+      tags: TC_015

+ 9 - 15
roles/compute_gpu/vars/main.yml

@@ -13,18 +13,12 @@
 #  limitations under the License.
 ---
 
-nvidia_docker_repo_url: https://nvidia.github.io/nvidia-docker/centos7/nvidia-docker.repo
-
-nvidia_docker_repo_dest: /etc/yum.repos.d/nvidia-docker.repo
-
-nvidia_container_repo_url: https://nvidia.github.io/libnvidia-container/centos7/libnvidia-container.repo 
-
-nvidia_container_repo_dest: /etc/yum.repos.d/libnvidia-container.repo
-
-nvidia_packages:
-  - kmod-nvidia
-  - nvidia-docker2
-
-daemon_file_dest: /etc/docker/
-
-daemon_file_mode: 0644
+# Usage: test_omnia.yml
+host1: "100.10.20.30"
+host2: "100.20.30.40"
+host3: "100.30.40.50"
+inventory_path: "/var/lib/awx/projects/omnia/appliance/test"
+test_input_config_filename: "input_config_test.yml"
+test_case_success_msg: "Test case passed"
+test_case_failure_msg: "Test case failed"
+file_permission: 0644

+ 8 - 12
appliance/test/test_vars/test_web_ui_vars.yml

@@ -13,22 +13,17 @@
 #  limitations under the License.
 ---
 
-# Usage: tasks/main.yml
-awx_url: http://localhost
+# Usage: test_web_ui.yml
 return_status: 200
 fail_return_status: -1
-awx_listening_port: 80
+awx_listening_port: 8081
 time: 1
 actual_containers: 4
-empty_password: ""
-boundary_password: "a1b2c3d4"
-lengthy_password: "a1b2c3d4e5f6g7h8i9j10k11"
-unsupported_password: "un supported-password"
 package: "docker-ce"
-awx_exists_msg: "Installation Skipped: AWX instance is already running on your system"
-awx_not_exists_msg: "AWX does not exist"
-validate_password_success_msg: "Password validation succesful"
-validate_password_fail_msg: "Password validation failed"
+awx_exists_msg: "Test case passed: AWX instance is already running on your system"
+awx_not_exists_msg: "Test case failed: AWX does not exist"
+validate_password_success_msg: "Test case passed: Password validation succesful"
+validate_password_fail_msg: "Test case failed: Password validation failed"
 resource_exists_success_msg: "Success: Requested resource(s) exists"
 resource_exists_fail_msg: "Failure: Requested resource(s) does not exists"
 compute_group_name: "compute"
@@ -36,4 +31,5 @@ manager_group_name: "manager"
 tower_cli_package_name: "ansible-tower-cli"
 docker_container_name: "awx_web"
 container_up_status_success_msg: "Container is running successfully after the reboot"
-container_up_status_fail_msg: "Container is not running after the reboot"
+container_up_status_fail_msg: "Container is not running after the reboot"
+test_input_config_filename: input_config_test.yml

+ 281 - 169
appliance/test/test_web_ui.yml

@@ -1,159 +1,21 @@
-#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+# 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
+# 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.
+# 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.
 ---
 
 # Testcase OMNIA_CRM_US_AWXD_TC_001
-# Test case to validate the AWX password with empty string
-- name: OMNIA_CRM_US_AWXD_TC_001
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - block:
-        - name: Test the awx password with empty string
-          include_tasks: ../roles/web_ui/tasks/awx_password.yml
-          vars:
-            no_prompt: true
-            admin_password: "{{ empty_password }}"
-            admin_password_confirm: "{{ empty_password }}"
-
-      rescue:
-        - name: Validate error message
-          assert:
-            that: fail_msg_pwd_format in msg_pwd_format.msg
-            success_msg: "{{ validate_password_success_msg }}"
-            fail_msg: "{{ validate_password_fail_msg }}"
-      tags: TC_001
-
-# Testcase OMNIA_CRM_US_AWXD_TC_002
-# Test case to validate the AWX password with exactly 8 characters
-- name: OMNIA_CRM_US_AWXD_TC_002
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - name: Test the awx password with 8 characters
-      include_tasks: ../roles/web_ui/tasks/awx_password.yml
-      vars:
-        no_prompt: true
-        admin_password: "{{ boundary_password }}"
-        admin_password_confirm: "{{ boundary_password }}"
-      tags: TC_002
-
-    - name: Validate success message
-      assert:
-        that: success_msg_pwd_format in msg_pwd_format.msg
-        success_msg: "{{ validate_password_success_msg }}"
-        fail_msg: "{{ validate_password_fail_msg }}"
-      tags: TC_002
-
-# Testcase OMNIA_CRM_US_AWXD_TC_003
-# Test case to validate the AWX password with length greater than 15 characters
-- name: OMNIA_CRM_US_AWXD_TC_003
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - name: Test the awx password with length greater than 15 characters
-      include_tasks: ../roles/web_ui/tasks/awx_password.yml
-      vars:
-        no_prompt: true
-        admin_password: "{{ lengthy_password }}"
-        admin_password_confirm: "{{ lengthy_password }}"
-      tags: TC_003
-
-    - name: Validate success message
-      assert:
-        that: success_msg_pwd_format in msg_pwd_format.msg
-        success_msg: "{{ validate_password_success_msg }}"
-        fail_msg: "{{ validate_password_fail_msg }}"
-      tags: TC_003
-
-# Testcase OMNIA_CRM_US_AWXD_TC_004
-# Test case to validate the AWX password when confirm password is given incorrect
-- name: OMNIA_CRM_US_AWXD_TC_004
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - block:
-        - name: Test the awx installation if confirm password is given incorrect
-          include_tasks: ../roles/web_ui/tasks/awx_password.yml
-          vars:
-            no_prompt: true
-            admin_password: "{{ boundary_password }}"
-            admin_password_confirm: "{{ lengthy_password }}"
-
-      rescue:
-        - name: Validate error message
-          assert:
-            that: fail_msg_pwd_confirm in msg_pwd_confirm.msg
-            success_msg: "{{ validate_password_success_msg }}"
-            fail_msg: "{{ validate_password_fail_msg }}"
-      tags: TC_004
-
-# Testcase OMNIA_CRM_US_AWXD_TC_005
-# Test case to validate the AWX password with unsupported strings
-- name: OMNIA_CRM_US_AWXD_TC_005
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - block:
-        - name: Test the awx password with unsupported strings
-          include_tasks: ../roles/web_ui/tasks/awx_password.yml
-          vars:
-            no_prompt: true
-            admin_password: "{{ unsupported_password }}"
-            admin_password_confirm: "{{ unsupported_password }}"
-
-      rescue:
-        - name: Validate error message
-          assert:
-            that: fail_msg_pwd_format in msg_pwd_format.msg
-            success_msg: "{{ validate_password_success_msg }}"
-            fail_msg: "{{ validate_password_fail_msg }}"
-      tags: TC_005
-
-# Testcase OMNIA_CRM_US_AWXD_TC_006
 # Test case to verify the prerequisites are installed and execute the AWX deployment
-- name: OMNIA_CRM_US_AWXD_TC_006
+- name: OMNIA_CRM_US_AWXD_TC_001
   hosts: localhost
   connection: local
   gather_subset:
@@ -165,38 +27,44 @@
     - name: Get the docker package facts
       package_facts:
         manager: auto
-      tags: TC_006
+      tags: TC_001
 
     - name: Check if docker-ce is already installed
       debug:
         var: ansible_facts.packages['{{ package }}']
-      tags: TC_006
+      tags: TC_001
 
     - block:
-        - name: Calling the role to be tested
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+          vars:
+            input_config_filename: "{{ test_input_config_filename }}"
+
+        - name: Calling the web_ui role to be tested
           include_role:
             name: ../roles/web_ui
-      tags: TC_006
+      tags: TC_001
 
     - name: Check that you can connect to github repo and it returns a status 200
       uri:
         url: "{{ awx_git_repo }}"
         status_code: "{{ return_status }}"
         return_content: true
-      tags: TC_006
+      tags: TC_001
 
     - name: Check that you can can connect to AWX UI and it returns a status 200
       uri:
-        url: "{{ awx_url }}"
+        url: "{{ awx_ip }}"
         status_code: "{{ return_status }}"
         return_content: true
-      tags: TC_006
+      tags: TC_001
 
-    - name: verify awx-server is listening on 80
+    - name: verify awx-server is listening on 8081
       wait_for:
         port: "{{ awx_listening_port }}"
         timeout: "{{ time }}"
-      tags: TC_006
+      tags: TC_001
 
     - name: Get the containers count
       shell: |
@@ -204,18 +72,18 @@
         docker ps -a | grep awx | wc -l
       register: containers_count
       changed_when: False
-      tags: TC_006
+      tags: TC_001
 
     - name: Validate the containers count
       assert:
         that: containers_count.stdout | int >= actual_containers
         success_msg: "{{ awx_exists_msg }}"
         fail_msg: "{{ awx_not_exists_msg }}"
-      tags: TC_006
+      tags: TC_001
 
-# Testcase OMNIA_CRM_US_AWXD_TC_007
+# Testcase OMNIA_CRM_US_AWXD_TC_002
 # Test case to verify regression testing
-- name: OMNIA_CRM_US_AWXD_TC_007
+- name: OMNIA_CRM_US_AWXD_TC_002
   hosts: localhost
   connection: local
   gather_subset:
@@ -225,30 +93,36 @@
     - test_vars/test_web_ui_vars.yml
   tasks:
     - block:
-        - name: Calling the role to be tested
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+          vars:
+            input_config_filename: "{{ test_input_config_filename }}"
+
+        - name: Calling the web_ui role to be tested
           include_role:
             name: ../roles/web_ui
-      tags: TC_007
+      tags: TC_002
 
     - name: Check that you can connect to github repo and it returns a status 200
       uri:
         url: "{{ awx_git_repo }}"
         status_code: "{{ return_status }}"
         return_content: true
-      tags: TC_007
+      tags: TC_002
 
     - name: Check that you can can connect to AWX UI and it returns a status 200
       uri:
-        url: "{{ awx_url }}"
+        url: "{{ awx_ip }}"
         status_code: "{{ return_status }}"
         return_content: true
-      tags: TC_007
+      tags: TC_002
 
     - name: verify awx-server is listening on 80
       wait_for:
         port: "{{ awx_listening_port }}"
         timeout: "{{ time }}"
-      tags: TC_007
+      tags: TC_002
 
     - name: Get the containers count
       shell: |
@@ -256,11 +130,249 @@
         docker ps -a | grep awx | wc -l
       register: containers_count
       changed_when: False
-      tags: TC_007
+      tags: TC_002
 
     - name: Validate the containers count
       assert:
         that: containers_count.stdout | int >= actual_containers
         success_msg: "{{ awx_exists_msg }}"
         fail_msg: "{{ awx_not_exists_msg }}"
-      tags: TC_007
+      tags: TC_002
+
+# Testcase OMNIA_CRM_US_AWXD_TC_003
+# Test case to validate the AWX configuration
+- name: OMNIA_CRM_US_AWXD_TC_003
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - ../roles/web_ui/vars/main.yml
+    - ../roles/common/vars/main.yml
+    - test_vars/test_web_ui_vars.yml
+  tasks:
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+          vars:
+            input_config_filename: "{{ test_input_config_filename }}"
+
+        - name: Calling the web_ui role to be tested
+          include_role:
+            name: ../roles/web_ui
+      tags: TC_003
+
+    - name: Get the package facts
+      package_facts:
+        manager: auto
+      tags: TC_003
+
+    - name: Check if ansible-tower-cli is already installed
+      assert:
+        that: "'{{ tower_cli_package_name }}' in ansible_facts.packages"
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing organizations
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        organizations list -f human
+      register: organizations_array
+      changed_when: False
+      tags: TC_003
+
+    - name: Check for organization
+      assert:
+        that: organization_name in organizations_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing projects
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        projects list -f human
+      changed_when: False
+      register: projects_array
+      tags: TC_003
+
+    - name: Check for project
+      assert:
+        that: project_name in projects_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing inventories
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        inventory list -f human
+      changed_when: False
+      register: inventory_array
+      tags: TC_003
+
+    - name: Check for inventories
+      assert:
+        that: omnia_inventory_name in inventory_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing groups if omnia-inventory exists
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        groups list --inventory "{{ omnia_inventory_name }}" -f human
+      changed_when: False
+      register: groups_array
+      when: omnia_inventory_name in inventory_array.stdout
+      tags: TC_003
+
+    - name: Check for manager and compute groups
+      assert:
+        that: manager_group_name and compute_group_name in groups_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing credentials
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        credentials list -f human
+      changed_when: False
+      register: credentials_array
+      tags: TC_003
+
+    - name: Check for "{{ credential_name }}"
+      assert:
+        that: credential_name in credentials_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing job templates
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        job_templates list -f human
+      changed_when: False
+      register: templates_array
+      tags: TC_003
+
+    - name: Check for templates
+      assert:
+        that: omnia_template_name and inventory_template_name in templates_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+    - name: Get the existing schedules for job templates
+      command: >-
+        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
+        schedules list -f human
+      changed_when: False
+      register: schedules_array
+      tags: TC_003
+
+    - name: Check for schedules to job template
+      assert:
+        that: schedule_name in schedules_array.stdout
+        success_msg: "{{ resource_exists_success_msg }}"
+        fail_msg: "{{ resource_exists_fail_msg }}"
+      tags: TC_003
+
+# Testcase OMNIA_CRM_US_AWXD_TC_004
+# Execute common role in management station without internet connectivity
+- name: OMNIA_CRM_US_AWXD_TC_004
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Down internet connectivity
+      lineinfile:
+        path: /etc/hosts
+        line: "172.16.0.5 github.com"
+        state: present
+        backup: yes
+      tags: TC_004
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+          vars:
+            input_config_filename: "{{ test_input_config_filename }}"
+
+        - name: Calling the web_ui role to be tested
+          include_role:
+            name: ../roles/web_ui
+
+      rescue:
+        - name: Validate internet connectivity failure message
+          assert:
+            that: internet_status in internet_value.msg
+            success_msg: "{{ internet_check_success_msg }}"
+            fail_msg: "{{ internet_check_fail_msg }}"
+      tags: TC_004
+
+    - name: Up internet connectivity
+      lineinfile:
+        path: /etc/hosts
+        line: "172.16.0.5 github.com"
+        state: absent
+      tags: TC_004
+
+# Testcase OMNIA_CRM_US_AWXD_TC_005
+# Execute web_ui role in management station and reboot the server
+- name: OMNIA_CRM_US_AWXD_TC_005
+  hosts: localhost
+  connection: local
+  vars_files:
+    - test_vars/test_web_ui_vars.yml
+  tasks:
+    - name: Get last uptime of the server
+      command: uptime -s
+      register: uptime_status
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_005
+
+    - name: Get current date
+      command: date +"%Y-%m-%d %H"
+      register: current_time
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_005
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+          vars:
+            input_config_filename: "{{ test_input_config_filename }}"
+
+        - name: Calling the web_ui role to be tested
+          include_role:
+            name: ../roles/web_ui
+      tags: TC_005
+
+    - name: Reboot localhost
+      command: reboot
+      when: current_time.stdout not in uptime_status.stdout
+      tags: TC_005
+
+    - name: Inspect AWX web container
+      docker_container_info:
+        name: "{{ docker_container_name }}"
+      register: awx_container_status
+      tags: TC_005
+
+    - name: Verify AWX container is running after reboot
+      assert:
+        that:
+          - "'running' in awx_container_status.container.State.Status"

+ 0 - 212
appliance/test/test_web_ui_awxc.yml

@@ -1,212 +0,0 @@
-#  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.
----
-
-# Testcase OMNIA_CRM_US_AWXD_TC_008
-# Test case to validate the AWX configuration
-- name: OMNIA_CRM_US_AWXD_TC_008
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-
-    - block:
-        - name: Call the role to be tested
-          include_role:
-            name: ../roles/web_ui
-      tags: TC_008
-
-    - name: Get the package facts
-      package_facts:
-        manager: auto
-      tags: TC_008
-
-    - name: Check if ansible-tower-cli is already installed
-      assert:
-        that: "'{{ tower_cli_package_name }}' in ansible_facts.packages"
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing organizations
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}" organizations list -f human
-      register: organizations_array
-      changed_when: False
-      tags: TC_008
-
-    - name: Check for organization
-      assert:
-        that: organization_name in organizations_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing projects
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}" projects list -f human
-      changed_when: False
-      register: projects_array
-      tags: TC_008
-
-    - name: Check for project
-      assert:
-        that: project_name in projects_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing inventories
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}" inventory list -f human
-      changed_when: False
-      register: inventory_array
-      tags: TC_008
-
-    - name: Check for inventories
-      assert:
-        that: omnia_inventory_name in inventory_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing groups if omnia-inventory exists
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}"
-        groups list --inventory "{{ omnia_inventory_name }}" -f human
-      changed_when: False
-      register: groups_array
-      when: omnia_inventory_name in inventory_array.stdout
-      tags: TC_008
-
-    - name: Check for manager and compute groups
-      assert:
-        that: manager_group_name and compute_group_name in groups_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing job templates
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}" job_templates list -f human
-      changed_when: False
-      register: templates_array
-      tags: TC_008
-
-    - name: Check for templates
-      assert:
-        that: omnia_template_name and inventory_template_name in templates_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-    - name: Get the existing schedules for job templates
-      command: >-
-        awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ admin_password }}" schedules list -f human
-      changed_when: False
-      register: schedules_array
-      tags: TC_008
-
-    - name: Check for schedules to job template
-      assert:
-        that: schedule_name in schedules_array.stdout
-        success_msg: "{{ resource_exists_success_msg }}"
-        fail_msg: "{{ resource_exists_fail_msg }}"
-      tags: TC_008
-
-# Testcase OMNIA_CRM_US_AWXD_TC_009
-# Execute common role in management station without internet connectivity
-- name: OMNIA_CRM_US_AWXD_TC_009
-  hosts: localhost
-  connection: local
-  gather_subset:
-    - 'min'
-  vars_files:
-    - test_vars/test_common_vars.yml
-    - ../roles/common/vars/main.yml
-  tasks:
-    - name: Down internet connectivity
-      lineinfile:
-        path: /etc/hosts
-        line: "172.16.0.5 github.com"
-        state: present
-        backup: yes
-      tags: TC_009
-
-    - block:
-        - name: Call common role
-          include_role:
-            name: ../roles/web_ui
-
-      rescue:
-        - name: Validate internet connectivity failure message
-          assert:
-            that: internet_status in internet_value.msg
-            success_msg: "{{ internet_check_success_msg }}"
-            fail_msg: "{{ internet_check_fail_msg }}"
-      tags: TC_009
-
-    - name: Up internet connectivity
-      lineinfile:
-        path: /etc/hosts
-        line: "172.16.0.5 github.com"
-        state: absent
-      tags: TC_009
-
-# Testcase OMNIA_CRM_US_AWXD_TC_010
-# Execute provision role in management station and reboot management station
-- name: OMNIA_CRM_US_AWXD_TC_010
-  hosts: localhost
-  connection: local
-  vars_files:
-    - test_vars/test_web_ui_vars.yml
-  tasks:
-    - name: Check last uptime of the server
-      shell: |
-        current_time=$(date +"%Y-%m-%d %H")
-        uptime -s | grep "$current_time"
-      register: uptime_status
-      changed_when: false
-      ignore_errors: yes
-      tags: TC_010
-
-    - block:
-        - name: Call web_ui role
-          include_role:
-            name: ../roles/web_ui
-          vars:
-            no_prompt: true
-      tags: TC_010
-
-    - name: Reboot localhost
-      command: reboot
-      when: uptime_status.stdout|length < 1
-      tags: TC_010
-
-    - name: Inspect AWX web container
-      docker_container_info:
-        name: "{{ docker_container_name }}"
-      register: awx_container_status
-      tags: TC_010
-
-    - name: Verify AWX container is running after reboot
-      assert:
-        that:
-          - "'running' in awx_container_status.container.State.Status"
-      tags: TC_010

+ 5 - 5
omnia.yml

@@ -24,11 +24,11 @@
   roles:
     - common
  
-- name: Apply GPU node config
-  hosts: gpus
-  gather_facts: false
-  roles:
-    - compute_gpu
+#- name: Apply GPU node config
+#  hosts: gpus
+#  gather_facts: false
+#  roles:
+#    - compute_gpu
 
 - name: Apply K8s manager config
   hosts: manager

roles/compute_gpu/files/daemon.json → roles/common/files/daemon.json


+ 18 - 0
roles/common/files/inventory.fact

@@ -0,0 +1,18 @@
+#!/bin/bash
+INVENTORY=$(mktemp lspci.XXXXXXXX)
+
+lspci > $INVENTORY
+
+NVIDIA_GPU=$(cat $INVENTORY | grep -i nvidia | wc -l)
+XILINX_FPGA=$(cat $INVENTORY | grep "Processing accelerators: Xilinx Corporation Device" | wc -l)
+INTEL_A10_FPGA=$(cat $INVENTORY | grep "Processing accelerators: Intel Corporation Device" | wc -l)
+
+cat << EOF
+{
+	"xilinx_fpga" : $XILINX_FPGA,
+	"nvidia_gpu" : $NVIDIA_GPU,
+	"intel_a10_fpga" : $INTEL_A10_FPGA
+}
+EOF
+
+rm -f $INVENTORY

+ 18 - 0
roles/common/tasks/main.yml

@@ -13,6 +13,17 @@
 #  limitations under the License.
 ---
 
+- name: Create a custom fact directory on each host
+  file:
+    path: /etc/ansible/facts.d
+    state: directory
+
+- name: Install accelerator discovery script
+  copy:
+    src: inventory.fact
+    dest: /etc/ansible/facts.d/inventory.fact
+    mode: 0755
+
 - name: Add kubernetes repo
   copy:
     src: kubernetes.repo
@@ -70,6 +81,9 @@
     state: present
   tags: install
 
+- name: Collect host facts (including acclerator information)
+  setup: ~
+
 - name: Install k8s packages
   package:
     name: "{{ k8s_packages }}"
@@ -107,3 +121,7 @@
 - name: Deploy time ntp/chrony
   include_tasks: ntp.yml
   tags: install
+
+- name: Install Nvidia drivers and software components
+  include_tasks: nvidia.yml
+  when: ansible_local.inventory.nvidia_gpu > 0

roles/compute_gpu/tasks/main.yml → roles/common/tasks/nvidia.yml


+ 13 - 0
roles/common/vars/main.yml

@@ -23,6 +23,7 @@ common_packages:
   - bash-completion
   - nvidia-detect
   - chrony
+  - pciutils
 
 k8s_packages:
   - kubelet-1.16.7
@@ -61,3 +62,15 @@ ntp_servers:
   - 2.centos.pool.ntp.org
 chrony_servers:
   - 2.centos.pool.ntp.org
+
+nvidia_docker_repo_url: https://nvidia.github.io/nvidia-docker/centos7/nvidia-docker.repo
+nvidia_docker_repo_dest: /etc/yum.repos.d/nvidia-docker.repo
+nvidia_container_repo_url: https://nvidia.github.io/libnvidia-container/centos7/libnvidia-container.repo
+nvidia_container_repo_dest: /etc/yum.repos.d/libnvidia-container.repo
+
+nvidia_packages:
+  - kmod-nvidia
+  - nvidia-docker2
+
+daemon_file_dest: /etc/docker/
+daemon_file_mode: 0644

+ 0 - 3
roles/compute_gpu/files/k8s.conf

@@ -1,3 +0,0 @@
-net.bridge.bridge-nf-call-ip6tables = 1
-net.bridge.bridge-nf-call-iptables = 1
-

+ 0 - 8
roles/compute_gpu/files/kubernetes.repo

@@ -1,8 +0,0 @@
-[kubernetes]
-name=Kubernetes
-baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
-enabled=1
-gpgcheck=1
-repo_gpgcheck=1
-gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
-