test_inventory.yml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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. # Test case to verify the prerequisites are installed and execute the AWX deployment
  16. - name: OMNIA_1.1_AWX_TC_001
  17. hosts: localhost
  18. connection: local
  19. vars_files:
  20. - test_vars/test_inventory_vars.yml
  21. tasks:
  22. - name: Check login_vars file is encrypted
  23. command: cat "{{ login_vars_path }}"
  24. changed_when: false
  25. register: config_content
  26. tags: always
  27. - name: Decrpyt login_vars.yml
  28. command: >-
  29. ansible-vault decrypt {{ login_vars_path }}
  30. --vault-password-file {{ login_vars_vault_path }}
  31. changed_when: false
  32. when: "'$ANSIBLE_VAULT;' in config_content.stdout"
  33. tags: always
  34. - name: Include variable file login_vars.yml
  35. include_vars: "{{ login_vars_path }}"
  36. tags: always
  37. - name: Encypt login file
  38. command: >-
  39. ansible-vault encrypt {{ login_vars_path }}
  40. --vault-password-file {{ login_vars_vault_path }}
  41. changed_when: false
  42. tags: always
  43. - name: Execute awx command
  44. command: "kubectl get pods -n {{ awx_namespace }}"
  45. changed_when: true
  46. register: k8s_pods
  47. run_once: true
  48. ignore_errors: true
  49. tags: TC_001,VERIFY_OMNIA_01
  50. - name: Validate awx operator containers
  51. assert:
  52. that:
  53. - k8s_pods.stdout | regex_search("{{ item }}")
  54. fail_msg: "{{ awx_fail_msg }}"
  55. success_msg: "{{ awx_success_msg }}"
  56. loop:
  57. - "awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})"
  58. - "awx-operator-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})"
  59. - "awx-postgres-([A-Za-z0-9]{1})"
  60. run_once: true
  61. tags: TC_001,VERIFY_OMNIA_01
  62. # Test case to verify inventory groups are present in AWX UI (idrac, ethernet, inifiniband, rbod)
  63. - name: OMNIA_1.1_AWX_TC_003
  64. hosts: localhost
  65. connection: local
  66. vars_files:
  67. - test_vars/test_inventory_vars.yml
  68. tasks:
  69. - name: Execute get pods command
  70. command: "kubectl get pods -n {{ awx_namespace }}"
  71. changed_when: true
  72. register: k8s_pods
  73. run_once: true
  74. ignore_errors: true
  75. tags: TC_003
  76. - name: Get awx pod
  77. set_fact:
  78. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  79. idrac_status: true
  80. with_items:
  81. - "{{ k8s_pods.stdout_lines }}"
  82. run_once: true
  83. when: item | regex_search(awx_pod_item_regex)
  84. tags: TC_003
  85. - name: Get awx cluster ip
  86. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  87. register: awx_cluster_ip
  88. changed_when: false
  89. ignore_errors: true
  90. tags: TC_003
  91. - name: Get AWX admin password
  92. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  93. register: awx_admin_password
  94. changed_when: false
  95. ignore_errors: true
  96. tags: TC_003
  97. - name: Execute awx get inventory hosts command
  98. command: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ item }} -f human --filter 'name'"
  99. register: idrac_hosts
  100. with_items:
  101. - "idrac_inventory"
  102. - "infiniband_inventory"
  103. - "ethernet_inventory"
  104. - "powervault_me4_inventory"
  105. run_once: true
  106. changed_when: false
  107. tags: TC_003
  108. - name: Verify inventory are present in AWX UI
  109. assert:
  110. that:
  111. - item.stdout_lines[0] | regex_search("name")
  112. fail_msg: "{{ item.item }} - {{ inventory_fail_msg }}"
  113. success_msg: "{{ item.item }} - {{ inventory_success_msg }}"
  114. with_items:
  115. - "{{ idrac_hosts.results }}"
  116. changed_when: false
  117. tags: TC_003
  118. # Test case to validate ip of idrac
  119. - name: OMNIA_1.1_AWX_TC_004
  120. hosts: localhost
  121. connection: local
  122. vars_files:
  123. - test_vars/test_inventory_vars.yml
  124. - ../input_params/base_vars.yml
  125. tasks:
  126. - name: Execute get pods command
  127. command: "kubectl get pods -n {{ awx_namespace }}"
  128. changed_when: true
  129. register: k8s_pods
  130. run_once: true
  131. ignore_errors: true
  132. tags: TC_004
  133. - name: Get awx pod
  134. set_fact:
  135. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  136. with_items:
  137. - "{{ k8s_pods.stdout_lines }}"
  138. run_once: true
  139. when: item | regex_search(awx_pod_item_regex)
  140. changed_when: false
  141. tags: TC_004
  142. - name: Get awx cluster ip
  143. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  144. register: awx_cluster_ip
  145. changed_when: false
  146. tags: TC_004
  147. - name: Get AWX admin password
  148. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  149. register: awx_admin_password
  150. changed_when: false
  151. ignore_errors: true
  152. tags: TC_004
  153. - name: Execute awx get inventory hosts command
  154. command: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ idrac_inventory_name }} -f human --filter 'name'"
  155. changed_when: true
  156. register: idrac_hosts
  157. run_once: true
  158. tags: TC_004
  159. - name: List of iDRAC host
  160. include_tasks: "{{ validation_script_path }}"
  161. with_items:
  162. - "{{ idrac_hosts.stdout_lines[2:] }}"
  163. when: idrac_hosts.stdout_lines | length > 2
  164. ignore_errors: true
  165. tags: TC_004
  166. - name: Empty iDRAC hosts
  167. debug:
  168. msg: "{{ empty_host_err }}"
  169. when: idrac_hosts.stdout_lines | length < 3
  170. failed_when: false
  171. tags: TC_004
  172. # Test case to validate ip of infiniband
  173. - name: OMNIA_1.1_AWX_TC_005
  174. hosts: localhost
  175. connection: local
  176. vars_files:
  177. - test_vars/test_inventory_vars.yml
  178. - ../input_params/base_vars.yml
  179. tasks:
  180. - name: Execute get pods command
  181. command: "kubectl get pods -n {{ awx_namespace }}"
  182. changed_when: true
  183. register: k8s_pods
  184. run_once: true
  185. ignore_errors: true
  186. tags: TC_005
  187. - name: Get awx pod
  188. set_fact:
  189. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  190. with_items:
  191. - "{{ k8s_pods.stdout_lines }}"
  192. run_once: true
  193. when: item | regex_search(awx_pod_item_regex)
  194. failed_when: false
  195. tags: TC_005
  196. - name: Get awx cluster ip
  197. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  198. register: awx_cluster_ip
  199. changed_when: false
  200. tags: TC_005
  201. - name: Get AWX admin password
  202. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  203. register: awx_admin_password
  204. changed_when: false
  205. ignore_errors: true
  206. tags: TC_005
  207. - name: Execute awx get inventory hosts command
  208. command: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ ib_inventory_name }} -f human --filter 'name'"
  209. changed_when: true
  210. register: infiniband_hosts
  211. run_once: true
  212. ignore_errors: true
  213. tags: TC_005
  214. - name: List of infiniband hosts
  215. include_tasks: "{{ validation_script_path }}"
  216. with_items:
  217. - "{{ infiniband_hosts.stdout_lines[2:] }}"
  218. when: infiniband_hosts.stdout_lines | length > 2
  219. ignore_errors: true
  220. tags: TC_005
  221. - name: Empty infiniband hosts
  222. debug:
  223. msg: "{{ empty_host_err }}"
  224. when: infiniband_hosts.stdout_lines | length < 3
  225. failed_when: false
  226. tags: TC_005
  227. # Test case to validate ip of ethernet
  228. - name: OMNIA_1.1_AWX_TC_006
  229. hosts: localhost
  230. connection: local
  231. vars_files:
  232. - test_vars/test_inventory_vars.yml
  233. - ../input_params/base_vars.yml
  234. tasks:
  235. - name: Execute get pods command
  236. command: "kubectl get pods -n {{ awx_namespace }}"
  237. changed_when: true
  238. register: k8s_pods
  239. run_once: true
  240. ignore_errors: true
  241. tags: TC_006
  242. - name: Get awx pod
  243. set_fact:
  244. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  245. with_items:
  246. - "{{ k8s_pods.stdout_lines }}"
  247. run_once: true
  248. when: item | regex_search(awx_pod_item_regex)
  249. failed_when: false
  250. tags: TC_006
  251. - name: Get awx cluster ip
  252. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  253. register: awx_cluster_ip
  254. changed_when: false
  255. tags: TC_006
  256. - name: Get AWX admin password
  257. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  258. register: awx_admin_password
  259. changed_when: false
  260. ignore_errors: true
  261. tags: TC_006
  262. - name: Execute awx get inventory hosts command
  263. command: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ ethernet_inventory_name }} -f human --filter 'name'"
  264. changed_when: true
  265. register: ethernet_hosts
  266. run_once: true
  267. ignore_errors: true
  268. tags: TC_006
  269. - name: List of ethernet hosts
  270. include_tasks: "{{ validation_script_path }}"
  271. with_items:
  272. - "{{ ethernet_hosts.stdout_lines[2:] }}"
  273. when: ethernet_hosts.stdout_lines | length > 2
  274. ignore_errors: true
  275. tags: TC_006
  276. - name: Empty ethernet hosts
  277. debug:
  278. msg: "{{ empty_host_err }}"
  279. when: ethernet_hosts.stdout_lines | length < 3
  280. failed_when: false
  281. tags: TC_006
  282. # Test case to validate ip of powervault
  283. - name: OMNIA_1.1_AWX_TC_007
  284. hosts: localhost
  285. connection: local
  286. vars_files:
  287. - test_vars/test_inventory_vars.yml
  288. - ../input_params/base_vars.yml
  289. tasks:
  290. - name: Execute get pods command
  291. command: "kubectl get pods -n {{ awx_namespace }}"
  292. changed_when: true
  293. register: k8s_pods
  294. run_once: true
  295. ignore_errors: true
  296. tags: TC_007
  297. - name: Get awx pod
  298. set_fact:
  299. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  300. idrac_status: true
  301. with_items:
  302. - "{{ k8s_pods.stdout_lines }}"
  303. run_once: true
  304. when: item | regex_search(awx_pod_item_regex)
  305. failed_when: false
  306. tags: TC_007
  307. - name: Get awx cluster ip
  308. shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  309. register: awx_cluster_ip
  310. changed_when: false
  311. tags: TC_007
  312. - name: Get AWX admin password
  313. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  314. register: awx_admin_password
  315. changed_when: false
  316. ignore_errors: true
  317. tags: TC_007
  318. - name: Execute awx get inventory hosts command
  319. command: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ pv_inventory_name }} -f human --filter 'name'"
  320. changed_when: true
  321. register: powervault_hosts
  322. run_once: true
  323. ignore_errors: true
  324. tags: TC_007
  325. - name: List of powervault hosts
  326. include_tasks: "{{ validation_script_path }}"
  327. with_items:
  328. - "{{ powervault_hosts.stdout_lines[2:] }}"
  329. when: powervault_hosts.stdout_lines | length > 2
  330. ignore_errors: true
  331. tags: TC_007
  332. - name: Empty powervault hosts
  333. debug:
  334. msg: "{{ empty_host_err }}"
  335. when: powervault_hosts.stdout_lines | length < 3
  336. failed_when: false
  337. tags: TC_007
  338. # Test case to verify omnia inventory groups (manager, compute, login, nfs)
  339. - name: OMNIA_1.1_AWX_TC_008
  340. hosts: localhost
  341. connection: local
  342. vars_files:
  343. - test_vars/test_inventory_vars.yml
  344. - ../roles/webui_awx/vars/main.yml
  345. tasks:
  346. - name: Get awx-service Cluster-IP
  347. command: "kubectl get svc awx-service -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  348. register: awx_cluster_ip
  349. changed_when: false
  350. run_once: true
  351. ignore_errors: true
  352. tags: TC_008
  353. - name: Get AWX admin password
  354. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  355. register: awx_admin_password
  356. changed_when: false
  357. run_once: true
  358. ignore_errors: true
  359. tags: TC_008
  360. - name: Set IP and password
  361. set_fact:
  362. awx_ip: 'http://{{ awx_cluster_ip.stdout }}'
  363. admin_password: "{{ awx_admin_password.stdout }}"
  364. run_once: true
  365. failed_when: false
  366. tags: TC_008
  367. - name: Get omnia inventory groups
  368. awx.awx.tower_group:
  369. name: "{{ item.name }}"
  370. description: "{{ item.description }}"
  371. inventory: "node_inventory"
  372. state: present
  373. loop: "{{ group_names }}"
  374. register: awx_group
  375. run_once: true
  376. ignore_errors: true
  377. tags: TC_008
  378. - name: Verify omnia inventory groups
  379. assert:
  380. that:
  381. - item.changed == false
  382. - item.item.name == "{{ manager_group }}" or
  383. item.item.name =="{{ compute_group }}" or
  384. item.item.name == "{{ login_group }}" or
  385. item.item.name == "{{ nfs_group }}"
  386. fail_msg: "{{ item .item.name }}{{ group_fail_msg }}"
  387. success_msg: "{{ item .item.name }}{{ group_success_msg }}"
  388. with_items:
  389. - "{{ awx_group.results }}"
  390. failed_when: false
  391. tags: TC_008
  392. # Test case to verify AWX configuration is done properly with job_templates, schedules in place
  393. - name: OMNIA_1.1_AWX_TC_009
  394. hosts: localhost
  395. connection: local
  396. vars_files:
  397. - test_vars/test_inventory_vars.yml
  398. - ../roles/webui_awx/vars/main.yml
  399. tasks:
  400. - name: Get awx-service Cluster-IP
  401. command: "kubectl get svc awx-service -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  402. register: awx_cluster_ip
  403. changed_when: false
  404. ignore_errors: true
  405. run_once: true
  406. tags: TC_009
  407. - name: Get AWX admin password
  408. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  409. register: awx_admin_password
  410. changed_when: false
  411. ignore_errors: true
  412. run_once: true
  413. tags: TC_009
  414. - name: Set IP and password
  415. set_fact:
  416. awx_ip: 'http://{{ awx_cluster_ip.stdout }}'
  417. admin_password: "{{ awx_admin_password.stdout }}"
  418. failed_when: false
  419. run_once: true
  420. tags: TC_009
  421. - name: Get job template details
  422. awx.awx.tower_job_template:
  423. name: "{{ item.name }}"
  424. job_type: "run"
  425. organization: "{{ organization_name }}"
  426. inventory: "{{ item.inventory }}"
  427. project: "{{ project_name }}"
  428. playbook: "{{ item.playbook }}"
  429. credentials:
  430. - "{{ item.credential }}"
  431. state: present
  432. tower_config_file: "{{ tower_config_file_path }}"
  433. loop: "{{ job_template_details }}"
  434. register: job_template
  435. when: item.flag
  436. ignore_errors: true
  437. tags: TC_009
  438. - name: Validate job template
  439. assert:
  440. that:
  441. - item.changed == false
  442. fail_msg: "{{ item.item.name }}{{ job_template_fail_msg }}"
  443. success_msg: " {{ item.item.name }} {{ job_template_success_msg }}"
  444. with_items:
  445. - "{{ job_template.results }}"
  446. failed_when: false
  447. when: item.item.flag
  448. tags: TC_009
  449. - name: Build a schedule for job template
  450. awx.awx.tower_schedule:
  451. name: "{{ item.name }}"
  452. unified_job_template: "{{ item.template }}"
  453. rrule: "{{ schedule_rule }}"
  454. state: present
  455. tower_config_file: "{{ tower_config_file_path }}"
  456. register: schedule
  457. loop: "{{ scheduled_templates }}"
  458. failed_when: false
  459. run_once: true
  460. tags: TC_009
  461. - name: Validate schedule status
  462. assert:
  463. that:
  464. - schedule.changed == false
  465. fail_msg: "{{ schedule_fail_msg }}"
  466. success_msg: "{{ schedule_success_msg }}"
  467. failed_when: false
  468. tags: TC_009
  469. # Test case to verify updation of new node in omnia inventory
  470. - name: OMNIA_1.1_AWX_TC_010
  471. hosts: localhost
  472. connection: local
  473. vars_files:
  474. - test_vars/test_inventory_vars.yml
  475. - ../input_params/base_vars.yml
  476. tasks:
  477. - name: Execute get pods command
  478. command: "kubectl get pods -n {{ awx_namespace }}"
  479. changed_when: true
  480. register: k8s_pods
  481. run_once: true
  482. ignore_errors: true
  483. tags: TC_010
  484. - name: Get awx pod
  485. set_fact:
  486. awx_pods: "{{ item | regex_search(awx_pod_regex) | trim }}"
  487. with_items:
  488. - "{{ k8s_pods.stdout_lines }}"
  489. run_once: true
  490. when: item | regex_search(awx_pod_item_regex)
  491. failed_when: false
  492. tags: TC_010
  493. - name: Get AWX admin password
  494. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  495. register: awx_admin_password
  496. changed_when: false
  497. ignore_errors: true
  498. tags: TC_010
  499. - name: Execute awx get inventory hosts command
  500. command: "awx --conf.host {{ awx_host }} --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ node_inventory_name }} -f human --filter 'name'"
  501. changed_when: true
  502. register: node_hosts
  503. run_once: true
  504. failed_when: false
  505. tags: TC_010
  506. - name: Get node_inventory hosts
  507. command: ping -c1 {{ item }}
  508. delegate_to: localhost
  509. register: ping_result
  510. ignore_errors: yes
  511. changed_when: false
  512. with_items:
  513. - "{{ node_hosts.stdout_lines[2:] }}"
  514. when: node_hosts.stdout_lines | length > 2
  515. tags: TC_010
  516. - name: Verify updation of new node
  517. assert:
  518. that:
  519. - "'100% packet loss' not in item.stdout"
  520. fail_msg: "{{ node_fail_msg }}"
  521. success_msg: "{{ node_success_msg }}"
  522. with_items:
  523. - "{{ ping_result.results }}"
  524. when: node_hosts.stdout_lines | length > 2
  525. failed_when: false
  526. tags: TC_010
  527. - name: Empty node hosts
  528. debug:
  529. msg: "{{ empty_host_err }}"
  530. when: node_hosts.stdout_lines | length < 3
  531. tags: TC_010
  532. # Test case to verify AWX configuration is done properly with all items in place
  533. - name: OMNIA_1.1_AWX_TC_011
  534. hosts: localhost
  535. connection: local
  536. vars_files:
  537. - test_vars/test_inventory_vars.yml
  538. - ../roles/webui_awx/vars/main.yml
  539. tasks:
  540. - name: Get awx-service Cluster-IP
  541. command: "kubectl get svc awx-service -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
  542. register: awx_cluster_ip
  543. changed_when: false
  544. ignore_errors: true
  545. run_once: true
  546. tags: TC_011
  547. - name: Get AWX admin password
  548. shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
  549. register: awx_admin_password
  550. changed_when: false
  551. ignore_errors: true
  552. run_once: true
  553. tags: TC_011
  554. - name: Set IP and password
  555. set_fact:
  556. awx_ip: 'http://{{ awx_cluster_ip.stdout }}'
  557. admin_password: "{{ awx_admin_password.stdout }}"
  558. run_once: true
  559. tags: TC_011
  560. - name: Get organization details
  561. awx.awx.tower_organization:
  562. name: "{{ organization_name }}"
  563. description: "{{ org_description }}"
  564. state: present
  565. register: organization
  566. ignore_errors: true
  567. run_once: true
  568. tags: TC_011
  569. - name: Validate an organization
  570. assert:
  571. that:
  572. - organization.changed == false
  573. fail_msg: "{{ organization_fail_msg }}"
  574. success_msg: "{{ organization_success_msg }}"
  575. failed_when: false
  576. tags: TC_011
  577. - name: Get tower inventory details
  578. awx.awx.tower_inventory:
  579. name: "{{ item.name }}"
  580. description: "{{ item.description }}"
  581. organization: "{{ organization_name }}"
  582. state: present
  583. loop: "{{ inventory_names }}"
  584. register: inventory
  585. when: item.flag
  586. ignore_errors: true
  587. run_once: true
  588. tags: TC_011
  589. - name: Validate inventory status
  590. assert:
  591. that:
  592. - item.changed == false
  593. fail_msg: "{{ inventory_fail_msg }}"
  594. success_msg: "{{ inventory_success_msg }}"
  595. with_items:
  596. - "{{ inventory.results }}"
  597. failed_when: false
  598. tags: TC_011
  599. - name: Get job template details
  600. awx.awx.tower_job_template:
  601. name: "{{ item.name }}"
  602. job_type: "run"
  603. organization: "{{ organization_name }}"
  604. inventory: "{{ item.inventory }}"
  605. project: "{{ project_name }}"
  606. playbook: "{{ item.playbook }}"
  607. credentials:
  608. - "{{ item.credential }}"
  609. state: present
  610. loop: "{{ job_template_details }}"
  611. register: job_template
  612. when: item.flag
  613. ignore_errors: true
  614. run_once: true
  615. tags: TC_011
  616. - name: Validate job template
  617. assert:
  618. that:
  619. - item.changed == false
  620. fail_msg: "{{ item.item.name }} {{ job_template_fail_msg }}"
  621. success_msg: "{{ item.item.name }} {{ job_template_success_msg }}"
  622. with_items:
  623. - "{{ job_template.results }}"
  624. failed_when: false
  625. when: item.item.flag
  626. tags: TC_011
  627. - name: Get project details
  628. awx.awx.tower_project:
  629. name: "{{ project_name }}"
  630. description: "{{ project_description }}"
  631. organization: "{{ organization_name }}"
  632. state: present
  633. register: project
  634. ignore_errors: true
  635. run_once: true
  636. tags: TC_011
  637. - name: Verify project
  638. assert:
  639. that:
  640. - project.changed == false
  641. fail_msg: "{{ project_fail_msg }}"
  642. success_msg: "{{ project_success_msg }}"
  643. failed_when: false
  644. tags: TC_011
  645. - name: Build a schedule for job template
  646. awx.awx.tower_schedule:
  647. name: "{{ item.name }}"
  648. unified_job_template: "{{ item.template }}"
  649. rrule: "{{ schedule_rule }}"
  650. state: present
  651. register: schedule
  652. loop: "{{ scheduled_templates }}"
  653. failed_when: false
  654. run_once: true
  655. tags: TC_011
  656. - name: Validate schedule status
  657. assert:
  658. that:
  659. - schedule.changed == false
  660. fail_msg: "{{ schedule_fail_msg }}"
  661. success_msg: "{{ schedule_success_msg }}"
  662. failed_when: false
  663. tags: TC_011