test_acct.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Copyright 2022 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. - name: OMNIA_1.2_MS_TC_001
  16. hosts: localhost
  17. connection: local
  18. vars_files:
  19. - ../input_params/base_vars.yml
  20. - test_vars/test_acct_vars.yml
  21. gather_subset:
  22. - 'min'
  23. tags: VERIFY_OMNIA_02
  24. tasks:
  25. - name: Check OS Version
  26. assert:
  27. that:
  28. - 'ansible_distribution == "{{ os_name_leap }}"'
  29. success_msg: "{{ check_os_success_msg }}"
  30. fail_msg: "{{ check_os_fail_msg }}"
  31. tags: Check_OS
  32. # OMNIA_1.2_acct_TC_001
  33. # Test case to Verify the enable acct service
  34. - name: Enable the acct service
  35. shell: systemctl enable --now acct
  36. register: acct_enable
  37. when:
  38. - 'ansible_distribution == "{{ os_name_leap }}"'
  39. - name: Verify acct service whether enabled or not
  40. assert:
  41. that:
  42. - acct_enable.stderr | regex_search( "{{ acct_enabled }}")
  43. success_msg: "{{ acct_enable_success_msg }}"
  44. fail_msg: "{{ acct_disable_fail_msg }}"
  45. # OMNIA_1.2_acct_TC_002
  46. # Test case to Check and Start acct Service
  47. - name: Check the acct service status
  48. shell: systemctl status acct.service
  49. register: acct_status
  50. when:
  51. - 'ansible_distribution == "{{ os_name_leap }}"'
  52. - name: Verify acct service is started or not
  53. assert:
  54. that:
  55. - acct_status.stdout | regex_search( "{{ acct_active }}")
  56. success_msg: "{{ acct_service_success_msg }}"
  57. fail_msg: "{{ acct_service_fail_msg }}"
  58. # OMNIA_1.2_acct_TC_003
  59. # Test case to Verify the Package Installation
  60. - name: Check the acct Package Installation
  61. shell: rpm -qa | grep -i acct
  62. register: acct_package
  63. when:
  64. - 'ansible_distribution == "{{ os_name_leap }}"'
  65. - name: Verify acct Package whether installed or not
  66. assert:
  67. that:
  68. - acct_package.stdout | regex_search( "acct-6.6.4-2.25.x86_64")
  69. success_msg: "{{ acct_package_success_msg }}"
  70. fail_msg: "{{ acct_package_fail_msg }}"
  71. # OMNIA_1.2_acct_TC_004
  72. # Test case to Verify the disable acct service
  73. - name: Disable the acct service
  74. shell: systemctl disable acct.service
  75. register: acct_disable
  76. when:
  77. - 'ansible_distribution == "{{ os_name_leap }}"'
  78. - name: Enable the acct service
  79. shell: systemctl enable --now acct
  80. register: acct_enable
  81. when:
  82. - 'ansible_distribution == "{{ os_name_leap }}"'
  83. - name: Verify acct service whether disabled or not
  84. assert:
  85. that:
  86. - acct_disable.stderr | regex_search( "{{ acct_disabled }}")
  87. success_msg: "{{ acct_disable_success_msg }}"
  88. fail_msg: "{{ acct_disable_fail_msg }}"
  89. # OMNIA_1.2_acct_TC_005
  90. # Test case to Verify ac and sa version
  91. - name: Check the ac version
  92. shell: ac -V
  93. register: ac_version
  94. when:
  95. - 'ansible_distribution == "{{ os_name_leap }}"'
  96. - name: Check the as version
  97. shell: sa -V
  98. register: sa_version
  99. when:
  100. - 'ansible_distribution == "{{ os_name_leap }}"'
  101. - name: Verify ac version
  102. assert:
  103. that:
  104. - ac_version.stdout | regex_search( "{{ acct_ac_version }}")
  105. success_msg: "{{ acct_ac_version_success_msg }}"
  106. fail_msg: "{{ acct_ac_version_fail_msg }}"
  107. - name: Verify sa version
  108. assert:
  109. that:
  110. - sa_version.stdout | regex_search( "{{ acct_sa_version }}")
  111. success_msg: "{{ acct_sa_version_success_msg }}"
  112. fail_msg: "{{ acct_sa_version_fail_msg }}"
  113. # OMNIA_1.2_acct_TC_006
  114. # Test case to Check Package details of ac and sa utility
  115. - name: find the complete path of ac
  116. shell: which ac
  117. register: ac_path
  118. when:
  119. - 'ansible_distribution == "{{ os_name_leap }}"'
  120. - name: check the package details of ac utility
  121. shell: rpm -qf {{ ac_path.stdout }}
  122. register: ac_utility
  123. when:
  124. - 'ansible_distribution == "{{ os_name_leap }}"'
  125. - name: Verify package details of ac utility
  126. assert:
  127. that:
  128. - ac_utility.stdout | regex_search( "{{ acct_ac_sa_utility }}")
  129. success_msg: "{{ acct_ac_utility_success_msg }}"
  130. fail_msg: "{{ acct_ac_utility_fail_msg }}"
  131. - name: find the complete path of sa
  132. shell: which sa
  133. register: sa_path
  134. when:
  135. - 'ansible_distribution == "{{ os_name_leap }}"'
  136. - name: check the package details of sa utility
  137. shell: rpm -qf {{ sa_path.stdout }}
  138. register: sa_utility
  139. when:
  140. - 'ansible_distribution == "{{ os_name_leap }}"'
  141. - name: Verify package details of sa utility
  142. assert:
  143. that:
  144. - sa_utility.stdout | regex_search( "{{ acct_ac_sa_utility }}")
  145. success_msg: "{{ acct_sa_utility_success_msg }}"
  146. fail_msg: "{{ acct_sa_utility_fail_msg }}"