test_omnia_1.1.yml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. # Copyright 2021 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_1.1_US_CRD_TC_001
  16. # Execute omnia.yml with separate servers for manager,compute,login,nfs node with default parameters
  17. - name: OMNIA_1.1_US_CRD_TC_001
  18. hosts: localhost
  19. tasks:
  20. - name: Execute omnia.yml with default input parameters
  21. command: ansible-playbook omnia.yml -i inventory
  22. changed_when: false
  23. args:
  24. chdir: ../
  25. tags: TC_001
  26. - name: Validate omnia.yml
  27. command: ansible-playbook test_omnia_validation.yml -i ../inventory
  28. changed_when: false
  29. tags: TC_001
  30. #Testcase OMNIA_1.1_US_CRD_TC_005
  31. # Execute omnia.yml with addition of new compute node
  32. - name: OMNIA_1.1_US_CRD_TC_005
  33. hosts: localhost
  34. tasks:
  35. - name: Execute omnia.yml with default input parameters
  36. command: ansible-playbook omnia.yml -i inventory
  37. changed_when: false
  38. args:
  39. chdir: ../
  40. tags: TC_005
  41. - name: Validate omnia.yml
  42. command: ansible-playbook test_omnia_validation.yml -i ../inventory
  43. changed_when: false
  44. tags: TC_005
  45. - name: Include variable file
  46. include_vars: test_vars/test_omnia_1.1_vars.yml
  47. tags: TC_005
  48. - name: Creating test inventory file
  49. copy:
  50. dest: "test_inventory.yml"
  51. mode: '{{ file_permission }}'
  52. content: |
  53. [manager]
  54. {{ host1 }}
  55. [compute]
  56. {{ host2 }}
  57. {{ host5 }}
  58. [login_node]
  59. {{ host3 }}
  60. [nfs_node]
  61. - name: Verify if new compute node is added
  62. command: ansible --list-hosts compute -i test_inventory.yml
  63. changed_when: false
  64. register: compute_info
  65. tags: TC_005
  66. - name: Validate compute node
  67. assert:
  68. that:
  69. - "'{{ host5 }}' in compute_info.stdout"
  70. success_msg: "{{ compute_node_success_msg }}"
  71. fail_msg: "{{ compute_node_fail_msg }}"
  72. tags: TC_005
  73. #Testcase OMNIA_1.1_US_CRD_TC_006
  74. # Execute omnia.yml after removal of new compute node
  75. - name: OMNIA_1.1_US_CRD_TC_006
  76. hosts: localhost
  77. tasks:
  78. - name: Execute omnia.yml with default input parameters
  79. command: ansible-playbook omnia.yml -i test/test_inventory.yml
  80. changed_when: false
  81. args:
  82. chdir: ../
  83. tags: TC_006
  84. - name: Validate omnia.yml
  85. command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
  86. changed_when: false
  87. tags: TC_006
  88. - name: Delete one compute node
  89. copy:
  90. dest: "test_inventory.yml"
  91. mode: '{{ file_permission }}'
  92. content: |
  93. [manager]
  94. {{ host1 }}
  95. [compute]
  96. {{ host2 }}
  97. [login_node]
  98. {{ host3 }}
  99. [nfs_node]
  100. tags: TC_006
  101. - name: Execute omnia.yml with default input parameters
  102. command: ansible-playbook omnia.yml -i test/test_inventory.yml
  103. changed_when: false
  104. args:
  105. chdir: ../
  106. tags: TC_006
  107. - name: Verify if one compute node is deleted
  108. command: ansible --list-hosts compute -i test_inventory.yml
  109. register: compute_info
  110. changed_when: false
  111. tags: TC_006
  112. - name: Validate compute node
  113. assert:
  114. that:
  115. - "'{{ host5 }}' not in compute_info.stdout"
  116. success_msg: "{{ compute_node_del_success_msg }}"
  117. fail_msg: "{{ compute_node_del_fail_msg }}"
  118. tags: TC_006
  119. - name: Delete the inventory file
  120. file:
  121. state: absent
  122. path: test_inventory.yml
  123. tags: TC_006
  124. #Testcase OMNIA_1.1_US_CRD_TC_008
  125. # Execute Jupyterhub.yml and then Kubeflow.yml
  126. - name: OMNIA_1.1_US_CRD_TC_008
  127. hosts: localhost
  128. tasks:
  129. - name: Include variable file
  130. include_vars: test_vars/test_omnia_1.1_vars.yml
  131. tags: TC_008
  132. - name: Install Jupyterhub
  133. command: ansible-playbook platforms/jupyterhub.yml -i inventory
  134. changed_when: false
  135. args:
  136. chdir: ../
  137. tags: TC_008
  138. - name: Install Kubeflow
  139. command: ansible-playbook platforms/kubeflow.yml -i inventory
  140. changed_when: false
  141. args:
  142. chdir: ../
  143. tags: TC_008
  144. - name: OMNIA_1.1_US_CRD_TC_008
  145. hosts: manager
  146. vars_files:
  147. - test_vars/test_jupyterhub_vars.yml
  148. - test_vars/test_kubeflow_vars.yml
  149. tasks:
  150. - name: Waiting for the pods deployment
  151. pause:
  152. minutes: 5
  153. tags: TC_008
  154. - name: Checking K8s services
  155. command: kubectl get services
  156. register: k8s_services
  157. changed_when: false
  158. failed_when: True
  159. tags: TC_008
  160. - name: Validating JupyterHub services
  161. assert:
  162. that:
  163. - "'hub' in k8s_services.stdout"
  164. - "'proxy-public' in k8s_services.stdout"
  165. - "'proxy-api' in k8s_services.stdout"
  166. fail_msg: "{{ jupyterhub_services_fail_msg }}"
  167. success_msg: "{{ jupyterhub_services_success_msg }}"
  168. tags: TC_008
  169. - name: Checking all running pods under jupyterhub namespace
  170. command: kubectl get pods --namespace jupyterhub --field-selector=status.phase=Running
  171. register: jupyterhub_running_pods
  172. changed_when: false
  173. failed_when: True
  174. tags: TC_008
  175. - name: Validating JupyterHub pods
  176. assert:
  177. that:
  178. - "'hub' in default_jupyterhub_pods.stdout"
  179. - "'proxy' in default_jupyterhub_pods.stdout"
  180. fail_msg: "{{ jupyterhub_pods_fail_msg }}"
  181. success_msg: "{{ jupyterhub_pods_success_msg }}"
  182. tags: TC_008
  183. - name: Checking installed Kubeflow version
  184. command: kfctl version
  185. register: kfctl_version
  186. changed_when: false
  187. failed_when: True
  188. tags: TC_008
  189. - name: Checking pods under kubeflow namespace
  190. command: kubectl get pods --namespace kubeflow
  191. register: kubeflow_pods
  192. changed_when: false
  193. ignore_errors: True
  194. tags: TC_008
  195. - name: Checking pods under istio-system namespace
  196. command: kubectl get pods --namespace istio-system
  197. register: istio_system_pods
  198. changed_when: false
  199. ignore_errors: True
  200. tags: TC_008
  201. - name: Validating Kubeflow Installation
  202. assert:
  203. that:
  204. - "'command not found' not in kfctl_version.stdout"
  205. fail_msg: "{{ kubeflow_install_fail_msg }}"
  206. success_msg: "{{ kubeflow_install_success_msg }}"
  207. tags: TC_008
  208. - name: Validating Kubeflow pods deployment
  209. assert:
  210. that:
  211. - "'Running' in kubeflow_pods.stdout or 'ContainerCreating' in kubeflow_pods.stdout"
  212. - "'Running' in istio_system_pods.stdout or 'ContainerCreating' in istio_system_pods.stdout"
  213. fail_msg: "{{ kubeflow_pods_deployment_fail_msg }}"
  214. success_msg: "{{ kubeflow_pods_deployment_success_msg }}"
  215. tags: TC_008
  216. #Testcase OMNIA_1.1_US_CRD_TC_009
  217. # Execute omnia.yml and reboot all the nodes
  218. - name: OMNIA_1.1_US_CRD_TC_009
  219. hosts: localhost
  220. vars_files:
  221. - test_vars/test_k8s_common_vars.yml
  222. - test_vars/test_slurm_common_vars.yml
  223. tasks:
  224. - name: Include variable file
  225. include_vars: test_vars/test_omnia_1.1_vars.yml
  226. tags: TC_009
  227. - name: Execute omnia.yml with default input parameters
  228. command: ansible-playbook omnia.yml -i inventory
  229. changed_when: false
  230. args:
  231. chdir: ../
  232. tags: TC_009
  233. - name: Reboot the nodes
  234. command: ansible all -i ../inventory -b -B 1 -P 0 -m shell -a "sleep {{ sleep_time }} && reboot"
  235. changed_when: false
  236. tags: TC_009
  237. - name: Waiting for services to restart
  238. pause:
  239. minutes: "{{ pod_time }}"
  240. tags: TC_009
  241. - name: Validate omnia.yml
  242. command: ansible-playbook test_omnia_validation.yml -i ../inventory
  243. changed_when: false
  244. tags: TC_009
  245. # Testcase OMNIA_1.1_US_CRD_TC_002
  246. # Execute omnia.yml with single node scenario (manager, compute and login node on same server)
  247. - name: OMNIA_1.1_US_CRD_TC_002
  248. hosts: localhost
  249. tasks:
  250. - name: Include variable file
  251. include_vars: test_vars/test_omnia_1.1_vars.yml
  252. tags: TC_002
  253. - name: Creating test inventory file for single node scenario
  254. copy:
  255. dest: "test_inventory.yml"
  256. mode: '{{ file_permission }}'
  257. content: |
  258. [manager]
  259. {{ host1 }}
  260. [compute]
  261. {{ host1 }}
  262. [login_node]
  263. {{ host1 }}
  264. [nfs_node]
  265. tags: TC_002
  266. - name: Check if omnia config file is encrypted
  267. command: cat ../{{ config_filename }}
  268. changed_when: false
  269. register: config_content
  270. no_log: True
  271. tags: TC_002
  272. - name: Decrpyt omnia_config.yml
  273. command: >-
  274. ansible-vault decrypt ../{{ config_filename }}
  275. --vault-password-file ../{{ config_vaultname }}
  276. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  277. tags: TC_002
  278. - name: Edit input parameters in omnia_config.yml
  279. replace:
  280. path: ../omnia_config.yml
  281. regexp: 'k8s_cni: ""'
  282. replace: 'k8s_cni: "{{ k8s_cni_one }}"'
  283. tags: TC_002
  284. - name: Edit input parameters in omnia_config.yml
  285. replace:
  286. path: ../omnia_config.yml
  287. regexp: 'mariadb_password: ""'
  288. replace: 'mariadb_password: "{{ db_passwd_invalid }}"'
  289. tags: TC_002
  290. - name: Edit input parameters in omnia_config.yml
  291. replace:
  292. path: ../omnia_config.yml
  293. regexp: 'login_node_required:'
  294. replace: 'login_node_required: true'
  295. tags: TC_002
  296. - name: Edit input parameters in omnia_config.yml
  297. replace:
  298. path: ../omnia_config.yml
  299. regexp: 'k8s_pod_network_cidr: ""'
  300. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
  301. tags: TC_002
  302. - name: Run omnia.yml
  303. command: ansible-playbook omnia.yml -i test/test_inventory.yml
  304. failed_when: true
  305. changed_when: false
  306. register: db_error
  307. args:
  308. chdir: ../
  309. tags: TC_002
  310. - name: Validate mariadb password error
  311. assert:
  312. that:
  313. - '" mariadb_password not given in correct format" not in db_error.stdout'
  314. fail_msg: "{{ mariadb_password_error_fail_msg }}"
  315. success_msg: "{{ mariadb_password_error_success_msg }}"
  316. tags: TC_002
  317. - name: Delete the inventory file
  318. file:
  319. state: absent
  320. path: test_inventory.yml
  321. tags: TC_002
  322. # Testcase OMNIA_1.1_US_CRD_TC_003
  323. # Execute omnia.yml with single node scenario (manager, compute,login,nfs node on same server)
  324. - name: OMNIA_1.1_US_CRD_TC_003
  325. hosts: localhost
  326. tasks:
  327. - name: Include variable file
  328. include_vars: test_vars/test_omnia_1.1_vars.yml
  329. tags: TC_003
  330. - name: Creating inventory file for single node scenario
  331. copy:
  332. dest: "test_inventory.yml"
  333. mode: '{{ file_permission }}'
  334. content: |
  335. [manager]
  336. {{ host1 }}
  337. [compute]
  338. {{ host1 }}
  339. [login_node]
  340. {{ host1 }}
  341. [nfs_node]
  342. tags: TC_003
  343. - name: Check if omnia config file is encrypted
  344. command: cat ../{{ config_filename }}
  345. changed_when: false
  346. register: config_content
  347. no_log: True
  348. tags: TC_003
  349. - name: Decrpyt omnia_config.yml
  350. command: >-
  351. ansible-vault decrypt ../{{ config_filename }}
  352. --vault-password-file ../{{ config_vaultname }}
  353. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  354. tags: TC_003
  355. - name: Edit input parameters in omnia_config.yml
  356. replace:
  357. path: ../omnia_config.yml
  358. regexp: 'k8s_cni: ""'
  359. replace: 'k8s_cni: "{{ k8s_cni_one }}"'
  360. tags: TC_003
  361. - name: Edit input parameters in omnia_config.yml
  362. replace:
  363. path: ../omnia_config.yml
  364. regexp: 'mariadb_password: ""'
  365. replace: 'mariadb_password: "{{ db_passwd_invalid }}"'
  366. tags: TC_003
  367. - name: Edit input parameters in omnia_config.yml
  368. replace:
  369. path: ../omnia_config.yml
  370. regexp: 'login_node_required:'
  371. replace: 'login_node_required: true'
  372. tags: TC_003
  373. - name: Edit input parameters in omnia_config.yml
  374. replace:
  375. path: ../omnia_config.yml
  376. regexp: 'k8s_pod_network_cidr: ""'
  377. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
  378. tags: TC_003
  379. - name: Run omnia.yml
  380. command: ansible-playbook omnia.yml -i test/test_inventory.yml
  381. failed_when: true
  382. changed_when: false
  383. register: db_error
  384. args:
  385. chdir: ../
  386. tags: TC_003
  387. - name: Validate mariadb password error
  388. assert:
  389. that:
  390. - '" mariadb_password not given in correct format" not in db_error.stdout'
  391. fail_msg: "{{ mariadb_password_error_fail_msg }}"
  392. success_msg: "{{ mariadb_password_error_success_msg }}"
  393. tags: TC_003
  394. - name: Delete the inventory file
  395. changed_when: false
  396. file:
  397. state: absent
  398. path: test_inventory.yml
  399. tags: TC_003
  400. #Testcase OMNIA_1.1_US_CRD_TC_004
  401. # Execute omnia.yml with separate servers for manager,compute,login,nfs node on new kubernetes version
  402. - name: OMNIA_1.1_US_CRD_TC_004
  403. hosts: localhost
  404. tasks:
  405. - name: Include variable file
  406. include_vars: test_vars/test_omnia_1.1_vars.yml
  407. tags: TC_004
  408. - name: Creating test inventory
  409. copy:
  410. dest: "test_inventory.yml"
  411. mode: '{{ file_permission }}'
  412. content: |
  413. [manager]
  414. {{ host1 }}
  415. [compute]
  416. {{ host2 }}
  417. [login_node]
  418. {{ host3 }}
  419. [nfs_node]
  420. tags: TC_004
  421. - name: Check if omnia config file is encrypted
  422. command: cat ../{{ config_filename }}
  423. changed_when: false
  424. register: config_content
  425. no_log: True
  426. tags: TC_004
  427. - name: Decrpyt omnia_config.yml
  428. command: >-
  429. ansible-vault decrypt ../{{ config_filename }}
  430. --vault-password-file ../{{ config_vaultname }}
  431. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  432. tags: TC_004
  433. - name: Edit input parameters in omnia_config.yml
  434. replace:
  435. path: ../omnia_config.yml
  436. regexp: 'k8s_cni: ""'
  437. replace: 'k8s_cni: "{{ k8s_cni_two }}"'
  438. tags: TC_004
  439. - name: Edit input parameters in omnia_config.yml
  440. replace:
  441. path: ../omnia_config.yml
  442. regexp: 'mariadb_password: ""'
  443. replace: 'mariadb_password: "{{ db_passwd_complex }}"'
  444. tags: TC_004
  445. - name: Edit input parameters in omnia_config.yml
  446. replace:
  447. path: ../omnia_config.yml
  448. regexp: 'login_node_required:'
  449. replace: 'login_node_required: true'
  450. tags: TC_004
  451. - name: Edit input parameters in omnia_config.yml
  452. replace:
  453. path: ../omnia_config.yml
  454. regexp: 'k8s_pod_network_cidr: ""'
  455. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_default }}"'
  456. tags: TC_004
  457. - name: Edit input parameters in omnia_config.yml
  458. replace:
  459. path: ../omnia_config.yml
  460. regexp: 'k8s_version: ""'
  461. replace: 'k8s_version: "{{ k8s_new_version }}"'
  462. tags: TC_004
  463. - name: Execute omnia.yml
  464. command: ansible-playbook omnia.yml -i test/test_inventory.yml
  465. changed_when: false
  466. args:
  467. chdir: ../
  468. tags: TC_004
  469. - name: Validate omnia.yml
  470. command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
  471. changed_when: false
  472. tags: TC_004
  473. - name: Delete the inventory file
  474. file:
  475. state: absent
  476. path: test_inventory.yml
  477. tags: TC_004
  478. #Testcase OMNIA_1.1_US_CRD_TC_007
  479. # Execute omnia.yml after redeploying the cluster
  480. - name: OMNIA_1.1_US_CRD_TC_007
  481. hosts: localhost
  482. tasks:
  483. - name: Execute omnia.yml with default input parameters
  484. command: ansible-playbook omnia.yml -i inventory
  485. changed_when: false
  486. args:
  487. chdir: ../
  488. tags: TC_007
  489. - name: Re Execute omnia.yml
  490. command: ansible-playbook omnia.yml -i inventory
  491. changed_when: false
  492. args:
  493. chdir: ../
  494. tags: TC_007
  495. - name: Validate omnia.yml
  496. command: ansible-playbook test_omnia_validation.yml -i ../inventory
  497. changed_when: false
  498. tags: TC_007
  499. # Testcase OMNIA_1.1_US_CRD_TC_010
  500. # Execute omnia.yml with same server for manager and compute with slurm first and kubernetes later
  501. - name: OMNIA_1.1_US_CRD_TC_010
  502. hosts: localhost
  503. tasks:
  504. - name: Include variable file
  505. include_vars: test_vars/test_omnia_1.1_vars.yml
  506. tags: TC_010
  507. - name: Creating test inventory file
  508. copy:
  509. dest: "test_inventory.yml"
  510. mode: '{{ file_permission }}'
  511. content: |
  512. [manager]
  513. {{ host1 }}
  514. [compute]
  515. {{ host1 }}
  516. [login_node]
  517. {{ host3 }}
  518. [nfs_node]
  519. tags: TC_010
  520. - name: Check if omnia config file is encrypted
  521. command: cat ../{{ config_filename }}
  522. changed_when: false
  523. register: config_content
  524. no_log: True
  525. tags: TC_010
  526. - name: Decrpyt omnia_config.yml
  527. command: >-
  528. ansible-vault decrypt ../{{ config_filename }}
  529. --vault-password-file ../{{ config_vaultname }}
  530. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  531. tags: TC_010
  532. - name: Edit input parameters in omnia_config.yml
  533. replace:
  534. path: ../omnia_config.yml
  535. regexp: 'k8s_cni: ""'
  536. replace: 'k8s_cni: "{{ k8s_cni_one }}"'
  537. tags: TC_010
  538. - name: Edit input parameters in omnia_config.yml
  539. replace:
  540. path: ../omnia_config.yml
  541. regexp: 'mariadb_password: ""'
  542. replace: 'mariadb_password: "{{ db_passwd_default }}"'
  543. tags: TC_010
  544. - name: Edit input parameters in omnia_config.yml
  545. replace:
  546. path: ../omnia_config.yml
  547. regexp: 'login_node_required:'
  548. replace: 'login_node_required: true'
  549. tags: TC_010
  550. - name: Edit input parameters in omnia_config.yml
  551. replace:
  552. path: ../omnia_config.yml
  553. regexp: 'k8s_pod_network_cidr: ""'
  554. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
  555. tags: TC_010
  556. - name: Edit input parameters in omnia_config.yml
  557. replace:
  558. path: ../omnia_config.yml
  559. regexp: 'ipa_admin_password: ""'
  560. replace: 'ipa_admin_password: "{{ ipa_passwd_default }}"'
  561. tags: TC_010
  562. - name: Run omnia.yml
  563. command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
  564. failed_when: true
  565. changed_when: false
  566. args:
  567. chdir: ../
  568. tags: TC_010
  569. - name: Re Execute omnia.yml
  570. command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags slurm,freeipa
  571. changed_when: false
  572. args:
  573. chdir: ../
  574. tags: TC_010
  575. - name: Validate omnia.yml
  576. command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
  577. changed_when: false
  578. tags: TC_010
  579. # Testcase OMNIA_1.1_US_CRD_TC_011
  580. # Execute omnia.yml with separate servers for manager,compute,login,nfs node with slurm first and kubernetes later
  581. - name: OMNIA_1.1_US_CRD_TC_011
  582. hosts: localhost
  583. tasks:
  584. - name: Include variable file
  585. include_vars: test_vars/test_omnia_1.1_vars.yml
  586. tags: TC_011
  587. - name: Creating inventory file for
  588. copy:
  589. dest: "test_inventory.yml"
  590. mode: '{{ file_permission }}'
  591. content: |
  592. [manager]
  593. {{ host1 }}
  594. [compute]
  595. {{ host2 }}
  596. [login_node]
  597. {{ host3 }}
  598. [nfs_node]
  599. {{ host4 }}
  600. tags: TC_011
  601. - name: Check if omnia config file is encrypted
  602. command: cat ../{{ config_filename }}
  603. changed_when: false
  604. register: config_content
  605. no_log: True
  606. tags: TC_011
  607. - name: Decrpyt omnia_config.yml
  608. command: >-
  609. ansible-vault decrypt ../{{ config_filename }}
  610. --vault-password-file ../{{ config_vaultname }}
  611. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  612. tags: TC_011
  613. - name: Edit input parameters in omnia_config.yml
  614. replace:
  615. path: ../omnia_config.yml
  616. regexp: 'k8s_cni: ""'
  617. replace: 'k8s_cni: "{{ k8s_cni_one }}"'
  618. tags: TC_011
  619. - name: Edit input parameters in omnia_config.yml
  620. replace:
  621. path: ../omnia_config.yml
  622. regexp: 'mariadb_password: ""'
  623. replace: 'mariadb_password: "{{ db_passwd_default }}"'
  624. tags: TC_011
  625. - name: Edit input parameters in omnia_config.yml
  626. replace:
  627. path: ../omnia_config.yml
  628. regexp: 'login_node_required: '
  629. replace: 'login_node_required: true'
  630. tags: TC_011
  631. - name: Edit input parameters in omnia_config.yml
  632. replace:
  633. path: ../omnia_config.yml
  634. regexp: 'k8s_pod_network_cidr: ""'
  635. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
  636. tags: TC_011
  637. - name: Edit input parameters in omnia_config.yml
  638. replace:
  639. path: ../omnia_config.yml
  640. regexp: 'ipa_admin_password: ""'
  641. replace: 'ipa_admin_password: "{{ ipa_passwd_complex }}"'
  642. tags: TC_011
  643. - name: Run omnia.yml
  644. command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
  645. changed_when: false
  646. args:
  647. chdir: ../
  648. tags: TC_011
  649. - name: Run omnia.yml
  650. command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags slurm,freeipa
  651. changed_when: false
  652. args:
  653. chdir: ../
  654. tags: TC_011
  655. - name: Validate omnia.yml
  656. command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
  657. changed_when: false
  658. tags: TC_011
  659. - name: Delete the inventory file
  660. changed_when: false
  661. file:
  662. state: absent
  663. path: test_inventory.yml
  664. tags: TC_011
  665. # Testcase OMNIA_1.1_US_CRD_TC_012
  666. # Execute omnia.yml with separate servers for manager,compute,login,nfs node with slurm first and kubernetes later
  667. - name: OMNIA_1.1_US_CRD_TC_012
  668. hosts: localhost
  669. tasks:
  670. - name: Include variable file
  671. include_vars: test_vars/test_omnia_1.1_vars.yml
  672. tags: TC_012
  673. - name: Creating test inventory file
  674. copy:
  675. dest: "test_inventory.yml"
  676. mode: '{{ file_permission }}'
  677. content: |
  678. [manager]
  679. {{ host1 }}
  680. [compute]
  681. {{ host2 }}
  682. [login_node]
  683. {{ host3 }}
  684. [nfs_node]
  685. tags: TC_012
  686. - name: Check if omnia config file is encrypted
  687. command: cat ../{{ config_filename }}
  688. changed_when: false
  689. register: config_content
  690. no_log: True
  691. tags: TC_012
  692. - name: Decrpyt omnia_config.yml
  693. command: >-
  694. ansible-vault decrypt ../{{ config_filename }}
  695. --vault-password-file ../{{ config_vaultname }}
  696. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  697. tags: TC_012
  698. - name: Edit input parameters in omnia_config.yml
  699. replace:
  700. path: ../omnia_config.yml
  701. regexp: 'k8s_cni: ""'
  702. replace: 'k8s_cni: "{{ k8s_cni_two }}"'
  703. tags: TC_012
  704. - name: Edit input parameters in omnia_config.yml
  705. replace:
  706. path: ../omnia_config.yml
  707. regexp: 'mariadb_password: ""'
  708. replace: 'mariadb_password: "{{ db_passwd_default }}"'
  709. tags: TC_012
  710. - name: Edit input parameters in omnia_config.yml
  711. replace:
  712. path: ../omnia_config.yml
  713. regexp: 'login_node_required:'
  714. replace: 'login_node_required: false'
  715. tags: TC_012
  716. - name: Edit input parameters in omnia_config.yml
  717. replace:
  718. path: ../omnia_config.yml
  719. regexp: 'k8s_pod_network_cidr: ""'
  720. replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
  721. tags: TC_012
  722. - name: Edit input parameters in omnia_config.yml
  723. replace:
  724. path: ../omnia_config.yml
  725. regexp: 'ipa_admin_password: ""'
  726. replace: 'ipa_admin_password: "{{ ipa_passwd_invalid }}"'
  727. tags: TC_012
  728. - name: Run omnia.yml
  729. command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
  730. failed_when: true
  731. changed_when: false
  732. register: ipa_error
  733. args:
  734. chdir: ../
  735. tags: TC_012
  736. - name: Validate ipa admin password error
  737. assert:
  738. that:
  739. - '" Incorrect format provided for ipa_admin_password" not in ipa_error.stdout'
  740. fail_msg: "{{ ipa_password_error_fail_msg }}"
  741. success_msg: "{{ ipa_password_error_success_msg }}"
  742. tags: TC_012
  743. - name: Delete the inventory file
  744. file:
  745. state: absent
  746. path: test_inventory.yml
  747. tags: TC_012