123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- # Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- ---
- - name: OMNIA_1.2_MS_TC_001
- hosts: localhost
- connection: local
- vars_files:
- - ../input_params/base_vars.yml
- - test_vars/test_snoopy_vars.yml
- gather_subset:
- - 'min'
- tags: VERIFY_OMNIA_02
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name_rocky }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
- # OMNIA_1.2_snoopy_TC_001
- # Test case to Validate /var/log is available or not
- - name: Find /var/log all directories, exclude nginx and mysql
- find:
- paths: /var/log
- recurse: no
- file_type: directory
- excludes: 'nginx,mysql'
- register: islog_available
- - name: Verify log path and related directories available
- assert:
- that:
- - "islog_available.matched > 0 "
- success_msg: "{{ snoopy_log_path_success_msg }}"
- fail_msg: "{{ snoopy_log_path_fail_msg }}"
- # OMNIA_1.2_snoopy_TC_002
- # Test case to Validate snoopy is enabled in /var/log/secure
- - name: Test case to Validate snoopy is enabled in /var/log/secure
- shell: cat /var/log/secure | grep snoopy | wc -l
- register: secure_snoopy
- - name: Verify snoopy is enabled in /var/log/secure
- assert:
- that:
- - "secure_snoopy.stdout != 0"
- success_msg: "{{ secure_snoopy_enable_success_msg }}"
- fail_msg: "{{ secure_snoopy_enable_fail_msg }}"
- # OMNIA_1.2_snoopy_TC_003
- # Test case to Validate snoopy is enabled in /var/log/messages
- - name: Test case to Validate snoopy is enabled in /var/log/messages
- shell: cat /var/log/messages | grep snoopy | wc -l
- register: messages_snoopy
- - name: Verify snoopy is enabled in /var/log/messages
- assert:
- that:
- - "messages_snoopy.stdout != 0"
- success_msg: "{{ messages_snoopy_enable_success_msg }}"
- fail_msg: "{{ messages_snoopy_enable_fail_msg }}"
- # OMNIA_1.2_snoopy_TC_004
- # Test case to validate snoopy is disabled in MS
- - name: Disable the snoopy in log files
- shell: snoopy-disable
- register: snoopy_disable
- - name: Verify snoopy is disabled or not
- assert:
- that:
- - snoopy_disable.stdout | regex_search( "{{ Disabled }}")
- success_msg: "{{ snoopy_disabled_success_msg }}"
- fail_msg: "{{ snoopy_disabled_fail_msg }}"
- # OMNIA_1.2_snoopy_TC_005
- # Test case to Validate snoopy is disabled in /var/log/secure
- - name: Test case to Validate snoopy is enabled in /var/log/secure
- shell: cat /var/log/secure | grep snoopy | wc -l
- register: secure_snoopy_disabled
- - name: Verify snoopy is disabled in /var/log/secure
- assert:
- that:
- - "secure_snoopy_disabled.stdout > secure_snoopy.stdout"
- success_msg: "{{ secure_snoopy_disabled_success_msg }}"
- fail_msg: "{{ secure_snoopy_disabled_fail_msg }}"
- # OMNIA_1.2_snoopy_TC_006
- # Test case to validate snoopy is enable in MS
- - name: Enabled the snoopy in log files
- shell: snoopy-enable
- register: snoopy_enable
- - name: Verify snoopy is Enabled or not
- assert:
- that:
- - snoopy_enable.stdout | regex_search( "{{ Enabled }}")
- success_msg: "{{ snoopy_enable_success_msg }}"
- fail_msg: "{{ snoopy_enable_fail_msg }}"
|