Przeglądaj źródła

Issue #261: Fix for slurm jobs not getting submitted

Signed-off-by: blesson-james <blesson_james@Dellteam>
Lucas A. Wilson 4 lat temu
rodzic
commit
f27b4b99e8

+ 1 - 1
appliance/test/test_vars/test_web_ui_vars.yml

@@ -32,4 +32,4 @@ 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"
-test_input_config_filename: input_config_test.yml
+test_input_config_filename: appliance_config_test.yml

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

@@ -84,3 +84,43 @@
   include_tasks: amd.yml
   when: ansible_local.inventory.amd_gpu > 0
   tags: install
+
+- name: Get the hostname
+  command: hostname
+  register: machine_hostname
+  changed_when: true
+
+- name: Set facts for node hostname and ip
+  set_fact:
+    node_ip: "{{ inventory_hostname }}"
+    node_hostname: "{{ machine_hostname.stdout }}"
+
+- name: Add host name in hosts file
+  lineinfile:
+    dest: "{{ hosts_file_dest }}"
+    line: "{{ inventory_hostname }} {{ machine_hostname.stdout }}"
+    state: present
+    create: yes
+    mode: "{{ hosts_file_mode }}"
+
+- name: Add compute hosts info in manager node hosts file
+  lineinfile:
+    dest: "{{ hosts_file_dest }}"
+    line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
+    state: present
+    create: yes
+    mode: "{{ hosts_file_mode }}"
+  with_items:
+    - "{{ groups['compute'] }}"
+  when: "'manager' in group_names"
+
+- name: Add manager hosts info in compute node hosts file
+  lineinfile:
+    dest: "{{ hosts_file_dest }}"
+    line: "{{ hostvars[item].node_ip }} {{ hostvars[item].node_hostname }}"
+    state: present
+    create: yes
+    mode: "{{ hosts_file_mode }}"
+  with_items:
+    - "{{ groups['manager'] }}"
+  when: "'compute' in group_names"

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

@@ -70,3 +70,6 @@ nvidia_packages:
 
 daemon_file_dest: /etc/docker/
 daemon_file_mode: 0644
+
+hosts_file_dest: "/etc/hosts"
+hosts_file_mode: "0644"

+ 2 - 0
roles/slurm_common/files/slurm.conf

@@ -18,6 +18,7 @@ SlurmUser=
 #SlurmdUser=root
 SlurmctldPort=
 SlurmdPort=
+SrunPortRange=
 AuthType=auth/munge
 #JobCredentialPrivateKey=
 #JobCredentialPublicCertificate=
@@ -56,6 +57,7 @@ InactiveLimit=0
 MinJobAge=300
 KillWait=30
 Waittime=0
+MessageTimeout=60
 #
 # SCHEDULING
 SchedulerType=sched/backfill

+ 6 - 8
roles/slurm_common/tasks/main.yml

@@ -26,14 +26,6 @@
     backup: yes
     mode: "{{ common_mode }}"
 
-- name: Add host name in hosts file
-  lineinfile:
-    dest: "{{ hosts_dest }}"
-    line: "{{ inventory_hostname }} {{ host_name.stdout }}"
-    state: present
-    create: yes
-    mode: "{{ common_mode }}"
-
 - name: Install packages for slurm
   package:
     name: "{{ item }}"
@@ -86,6 +78,12 @@
     regexp: "SlurmdPort="
     line: "SlurmdPort={{ slurmd_port }}"
 
+- name: Add srun port range
+  lineinfile:
+    path: "{{ slurm_confpth }}"
+    regexp: "SrunPortRange="
+    line: "SrunPortRange={{ srun_port_range }}"
+
 - name: Add spool path
   lineinfile:
     path: "{{ slurm_confpth }}"

+ 1 - 0
roles/slurm_common/vars/main.yml

@@ -35,6 +35,7 @@ slurm_confpth: "/etc/slurm/slurm.conf"
 slurm_user: "slurm"
 slurmctld_port: "6817"
 slurmd_port: "6818"
+srun_port_range: "60001-63000"
 acct_port: "6819"
 slurm_uid: "6001"
 slurm_logpth: "/var/log/slurm/"

+ 1 - 0
roles/slurm_manager/tasks/main.yml

@@ -145,6 +145,7 @@
     - "{{ tcp_port1 }}"
     - "{{ tcp_port2 }}"
     - "{{ tcp_port3 }}"
+    - "{{ tcp_port4 }}"
     - "{{ udp_port3 }}"
     - "{{ udp_port1 }}"
     - "{{ udp_port2 }}"

+ 1 - 0
roles/slurm_manager/vars/main.yml

@@ -56,6 +56,7 @@ rpm_loop: "/rpmbuild/RPMS/x86_64/*.rpm"
 tcp_port1: "6817/tcp"
 tcp_port2: "6818/tcp"
 tcp_port3: "6819/tcp"
+tcp_port4: "60001-63000/tcp"
 udp_port1: "6817/udp"
 udp_port2: "6818/udp"
 udp_port3: "6819/udp"

+ 0 - 10
roles/slurm_start_services/tasks/main.yml

@@ -25,16 +25,6 @@
     dest: "{{ slurm_confpth }}"
     mode: "{{ slurm_mode }}"
 
-- name: Add compute hosts info in hosts file
-  lineinfile:
-    dest: "{{ hosts_dest }}"
-    line: "{{ hostvars[item].compute_host }} {{ hostvars[item].compute_ip }}"
-    state: present
-    create: yes
-    mode: "{{ common_mode }}"
-  with_items:
-    - "{{ groups['compute'] }}"
-
 - name: Enable slurmdbd on manager
   systemd:
     name: slurmdbd

+ 152 - 171
appliance/test/test_omnia.yml

@@ -18,24 +18,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_006
 
     - name: Creating inventory file with hosts associated to the groups
@@ -53,10 +53,17 @@
               {{ host2 }}
       tags: TC_006
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_006
 
@@ -106,24 +113,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_007
 
     - name: Creating inventory file with hosts associated to the groups
@@ -141,10 +148,17 @@
               {{ host2 }}
       tags: TC_007
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_007
 
@@ -155,12 +169,14 @@
             job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags slurm --monitor -f human
           changed_when: false
           register: command_output
+      tags: TC_007
 
-    - name: Validate success message
-      assert:
-        that: "'FAILED!' not in command_output.stdout"
-        success_msg: "{{ test_case_success_msg }}"
-        fail_msg: "{{ test_case_failure_msg }}"
+      rescue:
+        - 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
@@ -193,24 +209,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_008
 
     - name: Creating inventory file with hosts associated to the groups
@@ -228,10 +244,17 @@
               {{ host2 }}
       tags: TC_008
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_008
 
@@ -243,11 +266,12 @@
           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 }}"
+      rescue:
+        - 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
@@ -280,24 +304,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_009
 
     - name: Creating inventory file with hosts associated to the groups
@@ -314,10 +338,17 @@
               {{ host2 }}
       tags: TC_009
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_009
 
@@ -365,24 +396,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_010
 
     - name: Creating inventory file with hosts associated to the groups
@@ -400,10 +431,17 @@
               {{ host2 }}
       tags: TC_010
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_010
 
@@ -416,11 +454,12 @@
           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 }}"
+      rescue:
+        - 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
@@ -453,24 +492,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_011
 
     - name: Creating inventory file with hosts associated to the groups
@@ -485,13 +524,20 @@
 
           compute:
             hosts:
-            
+
+      tags: TC_011
+
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
       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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_011
 
@@ -539,24 +585,24 @@
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_012
 
     - name: Creating inventory file with hosts associated to the groups
@@ -576,10 +622,17 @@
               {{ host3 }}
       tags: TC_012
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_012
 
@@ -591,11 +644,12 @@
           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 }}"
+      rescue:
+        - 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
@@ -625,29 +679,29 @@
       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
+# Test case to validate the success 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
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_013
 
     - name: Creating inventory file with hosts associated to the groups
@@ -665,10 +719,17 @@
               {{ host1 }}
       tags: TC_013
 
+    - name: Get present working directory
+      command: >-
+        pwd
+      register: path
+      changed_when: false
+      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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
       tags: TC_013
 
@@ -681,9 +742,9 @@
           register: command_output
 
       rescue:
-        - name: Validate error message
+        - name: Validate success message
           assert:
-            that: "'FAILED!' in command_output.stdout"
+            that: "'FAILED!' not in command_output.stdout"
             success_msg: "{{ test_case_success_msg }}"
             fail_msg: "{{ test_case_failure_msg }}"
       tags: TC_013
@@ -711,29 +772,29 @@
       tags: TC_013
 
 # Testcase OMNIA_CRM_US_AWXD_TC_014
-# Test case to verify the disjunction validation when the hosts are disjoint
+# 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_014
   hosts: localhost
   connection: local
   vars_files:
-    - ../roles/web_ui/vars/main.yml
-    - ../roles/common/vars/main.yml
+    - ../appliance/roles/web_ui/vars/main.yml
+    - ../appliance/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 }}
+      command: cat ../appliance/test/{{ 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 }}
+      command: ansible-vault decrypt ../appliance/test/{{ 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 }}"
+      include_vars: "../appliance/test/{{ test_input_config_filename }}"
       tags: TC_014
 
     - name: Creating inventory file with hosts associated to the groups
@@ -742,111 +803,31 @@
         mode: '{{ file_permission }}'
         content: |
           ---
-          manager:
+          compute:
             hosts:
               {{ host1 }}
 
-          compute:
+          manager:
             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
+            hosts:
+              {{ host3 }}
 
-    - 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
+    - name: Get present working directory
       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
+        pwd
+      register: path
       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"
+        docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
       changed_when: false
-      tags: TC_015
+      tags: TC_014
 
     - block:
         - name: Launch the job template
@@ -862,7 +843,7 @@
             that: "'FAILED!' in command_output.stdout"
             success_msg: "{{ test_case_success_msg }}"
             fail_msg: "{{ test_case_failure_msg }}"
-      tags: TC_015
+      tags: TC_014
 
     - name: Delete the hosts
       command: >-
@@ -873,14 +854,14 @@
         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
+      tags: TC_014
 
     - name: Delete the inventory file
       ignore_errors: yes
       file:
         state: absent
         path: testinventory.yml
-      tags: TC_015
+      tags: TC_014
 
     - name: Create inventory file if it doesn't exist
       ignore_errors: yes
@@ -888,4 +869,4 @@
         path: "testinventory.yml"
         state: touch
         mode: '{{ file_permission }}'
-      tags: TC_015
+      tags: TC_014

+ 3 - 3
appliance/test/test_vars/test_omnia_vars.yml

@@ -17,8 +17,8 @@
 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"
+inventory_path: "/var/lib/awx/projects"
+test_input_config_filename: "appliance_config_test.yml"
 test_case_success_msg: "Test case passed"
 test_case_failure_msg: "Test case failed"
-file_permission: 0644
+file_permission: 0644