123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- # 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_006
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_007
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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
- tags: TC_007
- 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
- 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_008
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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
- 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
- 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_009
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_010
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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
- 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
- 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_011
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_012
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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
- 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
- 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 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_013
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: 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 }}/{{ path.stdout.split('/')[-2] }}/test/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 success message
- assert:
- that: "'FAILED!' not 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 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:
- - ../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 ../appliance/test/{{ test_input_config_filename }}
- changed_when: false
- register: config_content
- tags: TC_014
- - name: Decrpyt input_config.yml
- 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: "../appliance/test/{{ 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: |
- ---
- compute:
- hosts:
- {{ host1 }}
- manager:
- hosts:
- {{ host2 }}
- hosts:
- {{ host3 }}
- tags: TC_014
- - name: Get present working directory
- command: >-
- pwd
- register: path
- changed_when: false
- 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 }}/{{ path.stdout.split('/')[-2] }}/test/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
- 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_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
- 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_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
|