# Copyright 2021 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.

---
#Testcase OMNIA_1.1_US_CRD_TC_001
# Execute omnia.yml with separate servers for manager,compute,login,nfs node with default parameters
- name: OMNIA_1.1_US_CRD_TC_001
  hosts: localhost

  tasks:
    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i inventory
      changed_when: false
      args: 
        chdir: ../
      tags: TC_001
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i ../inventory
      changed_when: false
      tags: TC_001

#Testcase OMNIA_1.1_US_CRD_TC_005
# Execute omnia.yml with addition of new compute node
- name: OMNIA_1.1_US_CRD_TC_005
  hosts: localhost

  tasks:
  
    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i inventory
      changed_when: false
      args: 
        chdir: ../
      tags: TC_005
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i ../inventory
      changed_when: false
      tags: TC_005

    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_005

    - name: Creating test inventory file 
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
        
          [manager]
          {{ host1 }}

          [compute]
          {{ host2 }}          
          {{ host5 }}
          
          [login_node]
          {{ host3 }}

          [nfs_node]

    - name: Verify if new compute node is added
      command: ansible --list-hosts compute -i test_inventory.yml
      changed_when: false
      register: compute_info
      tags: TC_005

    - name: Validate compute node
      assert:
         that: 
           - "'{{ host5 }}' in compute_info.stdout"
         success_msg: "{{ compute_node_success_msg }}"
         fail_msg: "{{ compute_node_fail_msg }}"
      tags: TC_005

#Testcase OMNIA_1.1_US_CRD_TC_006
# Execute omnia.yml after removal of new compute node
- name: OMNIA_1.1_US_CRD_TC_006
  hosts: localhost

  tasks:

    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i test/test_inventory.yml
      changed_when: false
      args: 
        chdir: ../
      tags: TC_006
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
      changed_when: false
      tags: TC_006

    - name: Delete one compute node
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host2 }} 
          
          [login_node]
          {{ host3 }}

          [nfs_node]
      tags: TC_006
       
    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i test/test_inventory.yml
      changed_when: false
      args: 
        chdir: ../
      tags: TC_006

    - name: Verify if one compute node is deleted
      command:  ansible --list-hosts compute -i test_inventory.yml
      register: compute_info
      changed_when: false
      tags: TC_006

    - name: Validate compute node
      assert:
         that: 
           - "'{{ host5 }}' not in compute_info.stdout"
         success_msg: "{{ compute_node_del_success_msg }}"
         fail_msg: "{{ compute_node_del_fail_msg }}"
      tags: TC_006

    - name: Delete the inventory file
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_006

#Testcase OMNIA_1.1_US_CRD_TC_008
# Execute Jupyterhub.yml and then Kubeflow.yml
- name: OMNIA_1.1_US_CRD_TC_008
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_008

    - name: Install Jupyterhub
      command: ansible-playbook platforms/jupyterhub.yml -i inventory
      changed_when: false
      args:
        chdir: ../
      tags: TC_008

    - name: Install Kubeflow
      command: ansible-playbook platforms/kubeflow.yml -i inventory
      changed_when: false
      args:
        chdir: ../
      tags: TC_008

- name: OMNIA_1.1_US_CRD_TC_008
  hosts: manager
  vars_files:
    - test_vars/test_jupyterhub_vars.yml
    - test_vars/test_kubeflow_vars.yml

  tasks:
    - name: Waiting for the pods deployment
      pause:
        minutes: 5
      tags: TC_008
      
    - name: Checking K8s services
      command: kubectl get services
      register: k8s_services
      changed_when: false
      failed_when: True
      tags: TC_008

    - name: Validating JupyterHub services
      assert:
        that:
          - "'hub' in k8s_services.stdout"
          - "'proxy-public' in k8s_services.stdout"
          - "'proxy-api' in k8s_services.stdout"
        fail_msg: "{{ jupyterhub_services_fail_msg }}"
        success_msg: "{{ jupyterhub_services_success_msg }}"
      tags: TC_008
    
    - name: Checking all running pods under jupyterhub namespace
      command: kubectl get pods --namespace jupyterhub --field-selector=status.phase=Running
      register: jupyterhub_running_pods
      changed_when: false
      failed_when: True
      tags: TC_008

    - name: Validating JupyterHub pods
      assert:
        that:
          - "'hub' in default_jupyterhub_pods.stdout"
          - "'proxy' in default_jupyterhub_pods.stdout"
        fail_msg: "{{ jupyterhub_pods_fail_msg }}"
        success_msg: "{{ jupyterhub_pods_success_msg }}"
      tags: TC_008

    - name: Checking installed Kubeflow version
      command: kfctl version
      register: kfctl_version
      changed_when: false
      failed_when: True
      tags: TC_008

    - name: Checking pods under kubeflow namespace
      command: kubectl get pods --namespace kubeflow
      register: kubeflow_pods
      changed_when: false
      ignore_errors: True
      tags: TC_008

    - name: Checking pods under istio-system namespace
      command: kubectl get pods --namespace istio-system
      register: istio_system_pods
      changed_when: false
      ignore_errors: True
      tags: TC_008

    - name: Validating Kubeflow Installation
      assert:
        that:
          - "'command not found' not in kfctl_version.stdout"
        fail_msg: "{{ kubeflow_install_fail_msg }}"
        success_msg: "{{ kubeflow_install_success_msg }}"
      tags: TC_008

    - name: Validating Kubeflow pods deployment
      assert:
        that:
          - "'Running' in kubeflow_pods.stdout or 'ContainerCreating' in kubeflow_pods.stdout"
          - "'Running' in istio_system_pods.stdout or 'ContainerCreating' in istio_system_pods.stdout"
        fail_msg: "{{ kubeflow_pods_deployment_fail_msg }}"
        success_msg: "{{ kubeflow_pods_deployment_success_msg }}"
      tags: TC_008

#Testcase OMNIA_1.1_US_CRD_TC_009
# Execute omnia.yml and reboot all the nodes
- name: OMNIA_1.1_US_CRD_TC_009
  hosts: localhost
  vars_files:
    - test_vars/test_k8s_common_vars.yml
    - test_vars/test_slurm_common_vars.yml

  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_009

    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i inventory
      changed_when: false
      args: 
        chdir: ../
      tags: TC_009


    - name: Reboot the  nodes
      command: ansible all -i ../inventory -b -B 1 -P 0 -m shell -a "sleep {{ sleep_time }} && reboot"
      changed_when: false
      tags: TC_009

    - name: Waiting for services to restart
      pause:
         minutes: "{{ pod_time }}"
      tags: TC_009

    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i ../inventory
      changed_when: false
      tags: TC_009


# Testcase OMNIA_1.1_US_CRD_TC_002
# Execute omnia.yml with single node scenario (manager, compute and login node on same server)
- name: OMNIA_1.1_US_CRD_TC_002
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_002

    - name: Creating test inventory file for single node scenario
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host1 }}  
          
          [login_node]
          {{ host1 }}
           
          [nfs_node]
      tags: TC_002

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_002

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_002

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_one }}"'
      tags: TC_002

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_invalid }}"'
      tags: TC_002

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required:'
        replace: 'login_node_required: true'
      tags: TC_002

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
      tags: TC_002
      
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml
      failed_when: true
      changed_when: false
      register: db_error
      args: 
        chdir: ../
      tags: TC_002
      
    - name: Validate mariadb password error
      assert:
        that:
          - '" mariadb_password not given in correct format" not in db_error.stdout'
        fail_msg: "{{ mariadb_password_error_fail_msg }}"
        success_msg: "{{ mariadb_password_error_success_msg }}"
      tags: TC_002

    - name: Delete the inventory file
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_002

# Testcase OMNIA_1.1_US_CRD_TC_003
# Execute omnia.yml with single node scenario (manager, compute,login,nfs node on same server) 
- name: OMNIA_1.1_US_CRD_TC_003
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_003

    - name: Creating inventory file for single node scenario
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host1 }}  
          
          [login_node]
          {{ host1 }}

          [nfs_node]
      tags: TC_003

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_003

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_003

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_one }}"'
      tags: TC_003

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_invalid }}"'
      tags: TC_003

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required:'
        replace: 'login_node_required: true'
      tags: TC_003

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
      tags: TC_003
      
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml
      failed_when: true
      changed_when: false
      register: db_error
      args: 
        chdir: ../
      tags: TC_003
      
    - name: Validate mariadb password error
      assert:
        that:
          - '" mariadb_password not given in correct format" not in db_error.stdout'
        fail_msg: "{{ mariadb_password_error_fail_msg }}"
        success_msg: "{{ mariadb_password_error_success_msg }}"
      tags: TC_003

    - name: Delete the inventory file
      changed_when: false
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_003

#Testcase OMNIA_1.1_US_CRD_TC_004
# Execute omnia.yml with separate servers for manager,compute,login,nfs node on new kubernetes version
- name: OMNIA_1.1_US_CRD_TC_004
  hosts: localhost

  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_004

    - name: Creating test inventory
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host2 }}  
          
          [login_node]
          {{ host3 }}
         
          [nfs_node]

      tags: TC_004

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_004

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_004

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_two }}"'
      tags: TC_004

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_complex }}"'
      tags: TC_004

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required:'
        replace: 'login_node_required: true'
      tags: TC_004

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_default }}"'
      tags: TC_004

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_version: ""'
        replace: 'k8s_version: "{{ k8s_new_version }}"'
      tags: TC_004

    
    - name: Execute omnia.yml 
      command: ansible-playbook omnia.yml -i test/test_inventory.yml
      changed_when: false
      args: 
        chdir: ../
      tags: TC_004
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
      changed_when: false
      tags: TC_004

    - name: Delete the inventory file
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_004

#Testcase OMNIA_1.1_US_CRD_TC_007
# Execute omnia.yml after redeploying the cluster
- name: OMNIA_1.1_US_CRD_TC_007
  hosts: localhost

  tasks:
    - name: Execute omnia.yml with default input parameters
      command: ansible-playbook omnia.yml -i inventory
      changed_when: false
      args: 
        chdir: ../
      tags: TC_007

    - name: Re Execute omnia.yml
      command: ansible-playbook omnia.yml -i inventory
      changed_when: false
      args: 
        chdir: ../
      tags: TC_007
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i ../inventory
      changed_when: false
      tags: TC_007

# Testcase OMNIA_1.1_US_CRD_TC_010
# Execute omnia.yml with same server for manager and compute with slurm first and kubernetes later
- name: OMNIA_1.1_US_CRD_TC_010
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_010

    - name: Creating test inventory file
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host1 }}  
          
          [login_node]
          {{ host3 }}

          [nfs_node]
      tags: TC_010

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_010

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_010

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_one }}"'
      tags: TC_010

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_default }}"'
      tags: TC_010

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required:'
        replace: 'login_node_required: true'
      tags: TC_010

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
      tags: TC_010

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'ipa_admin_password: ""'
        replace: 'ipa_admin_password: "{{ ipa_passwd_default }}"' 
      tags: TC_010
      
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
      failed_when: true
      changed_when: false
      args: 
        chdir: ../
      tags: TC_010

    - name: Re Execute omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags slurm,freeipa
      changed_when: false
      args: 
        chdir: ../
      tags: TC_010
    
    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
      changed_when: false
      tags: TC_010



# Testcase OMNIA_1.1_US_CRD_TC_011
# Execute omnia.yml with separate servers for manager,compute,login,nfs node with slurm first and kubernetes later
- name: OMNIA_1.1_US_CRD_TC_011
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_011

    - name: Creating inventory file for
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host2 }}  
          
          [login_node]
          {{ host3 }}

          [nfs_node]
          {{ host4 }}
      tags: TC_011

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_011

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_011

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_one }}"'
      tags: TC_011

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_default }}"'
      tags: TC_011

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required: '
        replace: 'login_node_required: true'
      tags: TC_011

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
      tags: TC_011

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'ipa_admin_password: ""'
        replace: 'ipa_admin_password: "{{ ipa_passwd_complex }}"'
      tags: TC_011
      
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
      changed_when: false
      args: 
        chdir: ../
      tags: TC_011
    
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags slurm,freeipa
      changed_when: false
      args: 
        chdir: ../
      tags: TC_011

    - name: Validate omnia.yml
      command: ansible-playbook test_omnia_validation.yml -i test_inventory.yml
      changed_when: false
      tags: TC_011

    - name: Delete the inventory file
      changed_when: false
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_011

# Testcase OMNIA_1.1_US_CRD_TC_012
# Execute omnia.yml with separate servers for manager,compute,login,nfs node with slurm first and kubernetes later
- name: OMNIA_1.1_US_CRD_TC_012
  hosts: localhost
  tasks:
    - name: Include variable file
      include_vars: test_vars/test_omnia_1.1_vars.yml
      tags: TC_012

    - name: Creating test inventory file 
      copy:
        dest: "test_inventory.yml"
        mode: '{{ file_permission }}'
        content: |
         
          [manager]
          {{ host1 }}

          [compute]
          {{ host2 }}  
          
          [login_node]
          {{ host3 }}

          [nfs_node]
      tags: TC_012

    - name: Check if omnia config file is encrypted
      command: cat ../{{ config_filename }}
      changed_when: false
      register: config_content
      no_log: True
      tags: TC_012

    - name: Decrpyt omnia_config.yml
      command: >-
        ansible-vault decrypt ../{{ config_filename }}
        --vault-password-file ../{{ config_vaultname }}
      when: "'$ANSIBLE_VAULT;' in config_content.stdout"
      tags: TC_012

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_cni: ""'
        replace: 'k8s_cni: "{{ k8s_cni_two }}"'
      tags: TC_012

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'mariadb_password: ""'
        replace: 'mariadb_password: "{{ db_passwd_default }}"'
      tags: TC_012

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'login_node_required:'
        replace: 'login_node_required: false'
      tags: TC_012

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'k8s_pod_network_cidr: ""'
        replace: 'k8s_pod_network_cidr: "{{ k8s_pod_network_cidr_other }}"'
      tags: TC_012

    - name: Edit input parameters in omnia_config.yml
      replace:
        path: ../omnia_config.yml
        regexp: 'ipa_admin_password: ""'
        replace: 'ipa_admin_password: "{{ ipa_passwd_invalid }}"'
      tags: TC_012
      
    - name: Run omnia.yml
      command: ansible-playbook omnia.yml -i test/test_inventory.yml --skip-tags kubernetes
      failed_when: true
      changed_when: false
      register: ipa_error
      args: 
        chdir: ../
      tags: TC_012
      
    - name: Validate ipa admin password error
      assert:
        that:
          - '" Incorrect format provided for ipa_admin_password" not in ipa_error.stdout'
        fail_msg: "{{ ipa_password_error_fail_msg }}"
        success_msg: "{{ ipa_password_error_success_msg }}"
      tags: TC_012

    - name: Delete the inventory file
      file:
        state: absent
        path: test_inventory.yml
      tags: TC_012
