test_omnia.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. # Testcase OMNIA_CRM_US_AWXD_TC_006
  16. # Test case to validate whether the proper error message is displayed when slurm and kubernetes tags are skipped
  17. - name: OMNIA_CRM_US_AWXD_TC_006
  18. hosts: localhost
  19. connection: local
  20. vars_files:
  21. - ../appliance/roles/web_ui/vars/main.yml
  22. - ../appliance/roles/common/vars/main.yml
  23. - test_vars/test_omnia_vars.yml
  24. tasks:
  25. - name: Check input config file is encrypted
  26. command: cat ../appliance/test/{{ test_input_config_filename }}
  27. changed_when: false
  28. register: config_content
  29. tags: TC_006
  30. - name: Decrpyt input_config.yml
  31. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  32. changed_when: false
  33. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  34. tags: TC_006
  35. - name: Include variable file input_config.yml
  36. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  37. tags: TC_006
  38. - name: Creating inventory file with hosts associated to the groups
  39. copy:
  40. dest: "testinventory.yml"
  41. mode: '{{ file_permission }}'
  42. content: |
  43. ---
  44. manager:
  45. hosts:
  46. {{ host1 }}
  47. compute:
  48. hosts:
  49. {{ host2 }}
  50. tags: TC_006
  51. - name: Get present working directory
  52. command: >-
  53. pwd
  54. register: path
  55. changed_when: false
  56. tags: TC_006
  57. - name: Push the inventory to AWX
  58. shell: |
  59. set -o pipefail
  60. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  61. changed_when: false
  62. tags: TC_006
  63. - block:
  64. - name: Launch the job template
  65. command: >-
  66. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  67. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags slurm,kubernetes --monitor -f human
  68. changed_when: false
  69. register: command_output
  70. rescue:
  71. - name: Validate error message
  72. assert:
  73. that: "'FAILED!' in command_output.stdout"
  74. success_msg: "{{ test_case_success_msg }}"
  75. fail_msg: "{{ test_case_failure_msg }}"
  76. tags: TC_006
  77. - name: Delete the hosts
  78. command: >-
  79. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  80. hosts delete {{ host1 }} --monitor -f human
  81. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  82. hosts delete {{ host2 }} --monitor -f human
  83. changed_when: false
  84. tags: TC_006
  85. - name: Delete the inventory file
  86. ignore_errors: yes
  87. file:
  88. state: absent
  89. path: testinventory.yml
  90. tags: TC_006
  91. - name: Create inventory file if it doesn't exist
  92. ignore_errors: yes
  93. file:
  94. path: "testinventory.yml"
  95. state: touch
  96. mode: '{{ file_permission }}'
  97. tags: TC_006
  98. # Testcase OMNIA_CRM_US_AWXD_TC_007
  99. # Test case to validate whether the skip tags validation is passed when slurm tag is given
  100. - name: OMNIA_CRM_US_AWXD_TC_007
  101. hosts: localhost
  102. connection: local
  103. vars_files:
  104. - ../appliance/roles/web_ui/vars/main.yml
  105. - ../appliance/roles/common/vars/main.yml
  106. - test_vars/test_omnia_vars.yml
  107. tasks:
  108. - name: Check input config file is encrypted
  109. command: cat ../appliance/test/{{ test_input_config_filename }}
  110. changed_when: false
  111. register: config_content
  112. tags: TC_007
  113. - name: Decrpyt input_config.yml
  114. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  115. changed_when: false
  116. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  117. tags: TC_007
  118. - name: Include variable file input_config.yml
  119. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  120. tags: TC_007
  121. - name: Creating inventory file with hosts associated to the groups
  122. copy:
  123. dest: "testinventory.yml"
  124. mode: '{{ file_permission }}'
  125. content: |
  126. ---
  127. manager:
  128. hosts:
  129. {{ host1 }}
  130. compute:
  131. hosts:
  132. {{ host2 }}
  133. tags: TC_007
  134. - name: Get present working directory
  135. command: >-
  136. pwd
  137. register: path
  138. changed_when: false
  139. tags: TC_007
  140. - name: Push the inventory to AWX
  141. shell: |
  142. set -o pipefail
  143. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  144. changed_when: false
  145. tags: TC_007
  146. - block:
  147. - name: Launch the job template
  148. command: >-
  149. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  150. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags slurm --monitor -f human
  151. changed_when: false
  152. register: command_output
  153. tags: TC_007
  154. rescue:
  155. - name: Validate success message
  156. assert:
  157. that: "'FAILED!' not in command_output.stdout"
  158. success_msg: "{{ test_case_success_msg }}"
  159. fail_msg: "{{ test_case_failure_msg }}"
  160. tags: TC_007
  161. - name: Delete the hosts
  162. command: >-
  163. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  164. hosts delete {{ host1 }} --monitor -f human
  165. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  166. hosts delete {{ host2 }} --monitor -f human
  167. changed_when: false
  168. tags: TC_007
  169. - name: Delete the inventory file
  170. ignore_errors: yes
  171. file:
  172. state: absent
  173. path: testinventory.yml
  174. tags: TC_007
  175. - name: Create inventory file if it doesn't exist
  176. ignore_errors: yes
  177. file:
  178. path: "testinventory.yml"
  179. state: touch
  180. mode: '{{ file_permission }}'
  181. tags: TC_007
  182. # Testcase OMNIA_CRM_US_AWXD_TC_008
  183. # Test case to validate whether the skip tags validation is passed when kubernetes tag is given
  184. - name: OMNIA_CRM_US_AWXD_TC_008
  185. hosts: localhost
  186. connection: local
  187. vars_files:
  188. - ../appliance/roles/web_ui/vars/main.yml
  189. - ../appliance/roles/common/vars/main.yml
  190. - test_vars/test_omnia_vars.yml
  191. tasks:
  192. - name: Check input config file is encrypted
  193. command: cat ../appliance/test/{{ test_input_config_filename }}
  194. changed_when: false
  195. register: config_content
  196. tags: TC_008
  197. - name: Decrpyt input_config.yml
  198. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  199. changed_when: false
  200. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  201. tags: TC_008
  202. - name: Include variable file input_config.yml
  203. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  204. tags: TC_008
  205. - name: Creating inventory file with hosts associated to the groups
  206. copy:
  207. dest: "testinventory.yml"
  208. mode: '{{ file_permission }}'
  209. content: |
  210. ---
  211. manager:
  212. hosts:
  213. {{ host1 }}
  214. compute:
  215. hosts:
  216. {{ host2 }}
  217. tags: TC_008
  218. - name: Get present working directory
  219. command: >-
  220. pwd
  221. register: path
  222. changed_when: false
  223. tags: TC_008
  224. - name: Push the inventory to AWX
  225. shell: |
  226. set -o pipefail
  227. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  228. changed_when: false
  229. tags: TC_008
  230. - block:
  231. - name: Launch the job template
  232. command: >-
  233. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  234. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --skip_tags kubernetes --monitor -f human
  235. changed_when: false
  236. register: command_output
  237. rescue:
  238. - name: Validate success message
  239. assert:
  240. that: "'FAILED!' not in command_output.stdout"
  241. success_msg: "{{ test_case_success_msg }}"
  242. fail_msg: "{{ test_case_failure_msg }}"
  243. tags: TC_008
  244. - name: Delete the hosts
  245. command: >-
  246. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  247. hosts delete {{ host1 }} --monitor -f human
  248. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  249. hosts delete {{ host2 }} --monitor -f human
  250. changed_when: false
  251. tags: TC_008
  252. - name: Delete the inventory file
  253. ignore_errors: yes
  254. file:
  255. state: absent
  256. path: testinventory.yml
  257. tags: TC_008
  258. - name: Create inventory file if it doesn't exist
  259. ignore_errors: yes
  260. file:
  261. path: "testinventory.yml"
  262. state: touch
  263. mode: '{{ file_permission }}'
  264. tags: TC_008
  265. # Testcase OMNIA_CRM_US_AWXD_TC_009
  266. # Test case to validate whether the proper error message is displayed when no host is added to manager group
  267. - name: OMNIA_CRM_US_AWXD_TC_009
  268. hosts: localhost
  269. connection: local
  270. vars_files:
  271. - ../appliance/roles/web_ui/vars/main.yml
  272. - ../appliance/roles/common/vars/main.yml
  273. - test_vars/test_omnia_vars.yml
  274. tasks:
  275. - name: Check input config file is encrypted
  276. command: cat ../appliance/test/{{ test_input_config_filename }}
  277. changed_when: false
  278. register: config_content
  279. tags: TC_009
  280. - name: Decrpyt input_config.yml
  281. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  282. changed_when: false
  283. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  284. tags: TC_009
  285. - name: Include variable file input_config.yml
  286. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  287. tags: TC_009
  288. - name: Creating inventory file with hosts associated to the groups
  289. copy:
  290. dest: "testinventory.yml"
  291. mode: '{{ file_permission }}'
  292. content: |
  293. ---
  294. manager:
  295. hosts:
  296. compute:
  297. hosts:
  298. {{ host2 }}
  299. tags: TC_009
  300. - name: Get present working directory
  301. command: >-
  302. pwd
  303. register: path
  304. changed_when: false
  305. tags: TC_009
  306. - name: Push the inventory to AWX
  307. shell: |
  308. set -o pipefail
  309. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  310. changed_when: false
  311. tags: TC_009
  312. - block:
  313. - name: Launch the job template
  314. command: >-
  315. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  316. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  317. changed_when: false
  318. register: command_output
  319. rescue:
  320. - name: Validate error message
  321. assert:
  322. that: "'FAILED!' in command_output.stdout"
  323. success_msg: "{{ test_case_success_msg }}"
  324. fail_msg: "{{ test_case_failure_msg }}"
  325. tags: TC_009
  326. - name: Delete the hosts
  327. command: >-
  328. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  329. hosts delete {{ host2 }} --monitor -f human
  330. changed_when: false
  331. tags: TC_009
  332. - name: Delete the inventory file
  333. ignore_errors: yes
  334. file:
  335. state: absent
  336. path: testinventory.yml
  337. tags: TC_009
  338. - name: Create inventory file if it doesn't exist
  339. ignore_errors: yes
  340. file:
  341. path: "testinventory.yml"
  342. state: touch
  343. mode: '{{ file_permission }}'
  344. tags: TC_009
  345. # Testcase OMNIA_CRM_US_AWXD_TC_010
  346. # Test case to verify whether the manger group validation is passed when single host is present
  347. - name: OMNIA_CRM_US_AWXD_TC_010
  348. hosts: localhost
  349. connection: local
  350. vars_files:
  351. - ../appliance/roles/web_ui/vars/main.yml
  352. - ../appliance/roles/common/vars/main.yml
  353. - test_vars/test_omnia_vars.yml
  354. tasks:
  355. - name: Check input config file is encrypted
  356. command: cat ../appliance/test/{{ test_input_config_filename }}
  357. changed_when: false
  358. register: config_content
  359. tags: TC_010
  360. - name: Decrpyt input_config.yml
  361. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  362. changed_when: false
  363. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  364. tags: TC_010
  365. - name: Include variable file input_config.yml
  366. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  367. tags: TC_010
  368. - name: Creating inventory file with hosts associated to the groups
  369. copy:
  370. dest: "testinventory.yml"
  371. mode: '{{ file_permission }}'
  372. content: |
  373. ---
  374. manager:
  375. hosts:
  376. {{ host1 }}
  377. compute:
  378. hosts:
  379. {{ host2 }}
  380. tags: TC_010
  381. - name: Get present working directory
  382. command: >-
  383. pwd
  384. register: path
  385. changed_when: false
  386. tags: TC_010
  387. - name: Push the inventory to AWX
  388. shell: |
  389. set -o pipefail
  390. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  391. changed_when: false
  392. tags: TC_010
  393. - block:
  394. - name: Launch the job template
  395. command: >-
  396. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  397. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  398. changed_when: false
  399. register: command_output
  400. tags: TC_010
  401. rescue:
  402. - name: Validate success message
  403. assert:
  404. that: "'FAILED!' not in command_output.stdout"
  405. success_msg: "{{ test_case_success_msg }}"
  406. fail_msg: "{{ test_case_failure_msg }}"
  407. tags: TC_010
  408. - name: Delete the hosts
  409. command: >-
  410. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  411. hosts delete {{ host1 }} --monitor -f human
  412. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  413. hosts delete {{ host2 }} --monitor -f human
  414. changed_when: false
  415. tags: TC_010
  416. - name: Delete the inventory file
  417. ignore_errors: yes
  418. file:
  419. state: absent
  420. path: testinventory.yml
  421. tags: TC_010
  422. - name: Create inventory file if it doesn't exist
  423. ignore_errors: yes
  424. file:
  425. path: "testinventory.yml"
  426. state: touch
  427. mode: '{{ file_permission }}'
  428. tags: TC_010
  429. # Testcase OMNIA_CRM_US_AWXD_TC_011
  430. # Test case to validate whether the proper error message is displayed when no host is added to compute group
  431. - name: OMNIA_CRM_US_AWXD_TC_011
  432. hosts: localhost
  433. connection: local
  434. vars_files:
  435. - ../appliance/roles/web_ui/vars/main.yml
  436. - ../appliance/roles/common/vars/main.yml
  437. - test_vars/test_omnia_vars.yml
  438. tasks:
  439. - name: Check input config file is encrypted
  440. command: cat ../appliance/test/{{ test_input_config_filename }}
  441. changed_when: false
  442. register: config_content
  443. tags: TC_011
  444. - name: Decrpyt input_config.yml
  445. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  446. changed_when: false
  447. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  448. tags: TC_011
  449. - name: Include variable file input_config.yml
  450. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  451. tags: TC_011
  452. - name: Creating inventory file with hosts associated to the groups
  453. copy:
  454. dest: "testinventory.yml"
  455. mode: '{{ file_permission }}'
  456. content: |
  457. ---
  458. manager:
  459. hosts:
  460. {{ host3 }}
  461. compute:
  462. hosts:
  463. tags: TC_011
  464. - name: Get present working directory
  465. command: >-
  466. pwd
  467. register: path
  468. changed_when: false
  469. tags: TC_011
  470. - name: Push the inventory to AWX
  471. shell: |
  472. set -o pipefail
  473. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  474. changed_when: false
  475. tags: TC_011
  476. - block:
  477. - name: Launch the job template
  478. command: >-
  479. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  480. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  481. changed_when: false
  482. register: command_output
  483. rescue:
  484. - name: Validate error message
  485. assert:
  486. that: "'FAILED!' in command_output.stdout"
  487. success_msg: "{{ test_case_success_msg }}"
  488. fail_msg: "{{ test_case_failure_msg }}"
  489. tags: TC_011
  490. - name: Delete the hosts
  491. command: >-
  492. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  493. hosts delete {{ host3 }} --monitor -f human
  494. changed_when: false
  495. tags: TC_011
  496. - name: Delete the inventory file
  497. file:
  498. state: absent
  499. path: testinventory.yml
  500. ignore_errors: yes
  501. tags: TC_011
  502. - name: Create inventory file if it doesn't exist
  503. file:
  504. path: "testinventory.yml"
  505. mode: '{{ file_permission }}'
  506. state: touch
  507. ignore_errors: yes
  508. tags: TC_011
  509. # Testcase OMNIA_CRM_US_AWXD_TC_012
  510. # Test case to verify whether the compute group validation is passed when more than 1 host is present
  511. - name: OMNIA_CRM_US_AWXD_TC_012
  512. hosts: localhost
  513. connection: local
  514. vars_files:
  515. - ../appliance/roles/web_ui/vars/main.yml
  516. - ../appliance/roles/common/vars/main.yml
  517. - test_vars/test_omnia_vars.yml
  518. tasks:
  519. - name: Check input config file is encrypted
  520. command: cat ../appliance/test/{{ test_input_config_filename }}
  521. changed_when: false
  522. register: config_content
  523. tags: TC_012
  524. - name: Decrpyt input_config.yml
  525. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  526. changed_when: false
  527. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  528. tags: TC_012
  529. - name: Include variable file input_config.yml
  530. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  531. tags: TC_012
  532. - name: Creating inventory file with hosts associated to the groups
  533. copy:
  534. dest: "testinventory.yml"
  535. mode: '{{ file_permission }}'
  536. content: |
  537. ---
  538. manager:
  539. hosts:
  540. {{ host1 }}
  541. compute:
  542. hosts:
  543. {{ host2 }}
  544. hosts:
  545. {{ host3 }}
  546. tags: TC_012
  547. - name: Get present working directory
  548. command: >-
  549. pwd
  550. register: path
  551. changed_when: false
  552. tags: TC_012
  553. - name: Push the inventory to AWX
  554. shell: |
  555. set -o pipefail
  556. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  557. changed_when: false
  558. tags: TC_012
  559. - block:
  560. - name: Launch the job template
  561. command: >-
  562. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  563. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  564. changed_when: false
  565. register: command_output
  566. rescue:
  567. - name: Validate success message
  568. assert:
  569. that: "'FAILED!' not in command_output.stdout"
  570. success_msg: "{{ test_case_success_msg }}"
  571. fail_msg: "{{ test_case_failure_msg }}"
  572. tags: TC_012
  573. - name: Delete the hosts
  574. command: >-
  575. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  576. hosts delete {{ host1 }} --monitor -f human
  577. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  578. hosts delete {{ host2 }} --monitor -f human
  579. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  580. hosts delete {{ host3 }} --monitor -f human
  581. changed_when: false
  582. tags: TC_012
  583. - name: Delete the inventory file
  584. ignore_errors: yes
  585. file:
  586. state: absent
  587. path: testinventory.yml
  588. tags: TC_012
  589. - name: Create inventory file if it doesn't exist
  590. ignore_errors: yes
  591. file:
  592. path: "testinventory.yml"
  593. state: touch
  594. mode: '{{ file_permission }}'
  595. tags: TC_012
  596. # Testcase OMNIA_CRM_US_AWXD_TC_013
  597. # Test case to validate the success meesage when a host is present in both manager and compute groups
  598. - name: OMNIA_CRM_US_AWXD_TC_013
  599. hosts: localhost
  600. connection: local
  601. vars_files:
  602. - ../appliance/roles/web_ui/vars/main.yml
  603. - ../appliance/roles/common/vars/main.yml
  604. - test_vars/test_omnia_vars.yml
  605. tasks:
  606. - name: Check input config file is encrypted
  607. command: cat ../appliance/test/{{ test_input_config_filename }}
  608. changed_when: false
  609. register: config_content
  610. tags: TC_013
  611. - name: Decrpyt input_config.yml
  612. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  613. changed_when: false
  614. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  615. tags: TC_013
  616. - name: Include variable file input_config.yml
  617. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  618. tags: TC_013
  619. - name: Creating inventory file with hosts associated to the groups
  620. copy:
  621. dest: "testinventory.yml"
  622. mode: '{{ file_permission }}'
  623. content: |
  624. ---
  625. manager:
  626. hosts:
  627. {{ host1 }}
  628. compute:
  629. hosts:
  630. {{ host1 }}
  631. tags: TC_013
  632. - name: Get present working directory
  633. command: >-
  634. pwd
  635. register: path
  636. changed_when: false
  637. tags: TC_013
  638. - name: Push the inventory to AWX
  639. shell: |
  640. set -o pipefail
  641. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  642. changed_when: false
  643. tags: TC_013
  644. - block:
  645. - name: Launch the job template
  646. command: >-
  647. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  648. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  649. changed_when: false
  650. register: command_output
  651. rescue:
  652. - name: Validate success message
  653. assert:
  654. that: "'FAILED!' not in command_output.stdout"
  655. success_msg: "{{ test_case_success_msg }}"
  656. fail_msg: "{{ test_case_failure_msg }}"
  657. tags: TC_013
  658. - name: Delete the hosts
  659. command: >-
  660. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  661. hosts delete {{ host1 }} --monitor -f human
  662. changed_when: false
  663. tags: TC_013
  664. - name: Delete the inventory file
  665. ignore_errors: yes
  666. file:
  667. state: absent
  668. path: testinventory.yml
  669. tags: TC_013
  670. - name: Create inventory file if it doesn't exist
  671. ignore_errors: yes
  672. file:
  673. path: "testinventory.yml"
  674. state: touch
  675. mode: '{{ file_permission }}'
  676. tags: TC_013
  677. # Testcase OMNIA_CRM_US_AWXD_TC_014
  678. # Test case to validate whether the proper error message is displayed when more than one host is added to manager group
  679. - name: OMNIA_CRM_US_AWXD_TC_014
  680. hosts: localhost
  681. connection: local
  682. vars_files:
  683. - ../appliance/roles/web_ui/vars/main.yml
  684. - ../appliance/roles/common/vars/main.yml
  685. - test_vars/test_omnia_vars.yml
  686. tasks:
  687. - name: Check input config file is encrypted
  688. command: cat ../appliance/test/{{ test_input_config_filename }}
  689. changed_when: false
  690. register: config_content
  691. tags: TC_014
  692. - name: Decrpyt input_config.yml
  693. command: ansible-vault decrypt ../appliance/test/{{ test_input_config_filename }} --vault-password-file {{ vault_filename }}
  694. changed_when: false
  695. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  696. tags: TC_014
  697. - name: Include variable file input_config.yml
  698. include_vars: "../appliance/test/{{ test_input_config_filename }}"
  699. tags: TC_014
  700. - name: Creating inventory file with hosts associated to the groups
  701. copy:
  702. dest: "testinventory.yml"
  703. mode: '{{ file_permission }}'
  704. content: |
  705. ---
  706. compute:
  707. hosts:
  708. {{ host1 }}
  709. manager:
  710. hosts:
  711. {{ host2 }}
  712. hosts:
  713. {{ host3 }}
  714. tags: TC_014
  715. - name: Get present working directory
  716. command: >-
  717. pwd
  718. register: path
  719. changed_when: false
  720. tags: TC_014
  721. - name: Push the inventory to AWX
  722. shell: |
  723. set -o pipefail
  724. docker exec awx_task awx-manage inventory_import --inventory-name {{ omnia_inventory_name }} --source "{{ inventory_path }}/{{ path.stdout.split('/')[-2] }}/test/testinventory.yml"
  725. changed_when: false
  726. tags: TC_014
  727. - block:
  728. - name: Launch the job template
  729. command: >-
  730. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  731. job_templates launch "{{ omnia_template_name }}" --credentials "{{ credential_name }}" --monitor -f human
  732. changed_when: false
  733. register: command_output
  734. rescue:
  735. - name: Validate error message
  736. assert:
  737. that: "'FAILED!' in command_output.stdout"
  738. success_msg: "{{ test_case_success_msg }}"
  739. fail_msg: "{{ test_case_failure_msg }}"
  740. tags: TC_014
  741. - name: Delete the hosts
  742. command: >-
  743. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  744. hosts delete {{ host1 }} --monitor -f human
  745. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  746. hosts delete {{ host2 }} --monitor -f human
  747. awx --conf.host "{{ awx_ip }}" --conf.username "{{ awx_user }}" --conf.password "{{ awx_password }}" --conf.insecure
  748. hosts delete {{ host3 }} --monitor -f human
  749. changed_when: false
  750. tags: TC_014
  751. - name: Delete the inventory file
  752. ignore_errors: yes
  753. file:
  754. state: absent
  755. path: testinventory.yml
  756. tags: TC_014
  757. - name: Create inventory file if it doesn't exist
  758. ignore_errors: yes
  759. file:
  760. path: "testinventory.yml"
  761. state: touch
  762. mode: '{{ file_permission }}'
  763. tags: TC_014