---
- name: Assert fail on EL 7 with version = 2022 and EL 9 with version != 2022
  include_tasks: assert_fail_on_unsupported_ver.yml

- name: Test while not settings mssql_tcp_port to default it to 1433
  vars:
    __mssql_test_port: 1433
  block:
    - name: Set up SQL Server
      include_role:
        name: linux-system-roles.mssql
      vars:
        mssql_password: "p@55w0rD"
        mssql_edition: Evaluation

    - name: >-
        Verify that the port is configured properly {{ __mssql_test_port }}
      include_tasks: tasks/verify_tcp_port.yml
      vars:
        __mssql_tcp_port_new: "{{ __mssql_test_port }}"

- name: Configure the mssql-server service start limit interval and burst
  include_tasks: tasks/mssql-sever-increase-start-limit.yml

- name: Test while settings mssql_tcp_port to to 1433
  vars:
    __mssql_test_port: 1433
  block:
    - name: Set up SQL Server
      include_role:
        name: linux-system-roles.mssql
      vars:
        mssql_password: "p@55w0rD"
        mssql_edition: Evaluation
        mssql_tcp_port: "{{ __mssql_test_port }}"

    - name: >-
        Verify that the port is configured properly {{ __mssql_test_port }}
      include_tasks: tasks/verify_tcp_port.yml
      vars:
        __mssql_tcp_port_new: "{{ __mssql_test_port }}"

- name: Test with mssql_tcp_port changed to 1435
  vars:
    __mssql_test_port: 1435
  block:
    - name: Set up SQL Server
      include_role:
        name: linux-system-roles.mssql
      vars:
        mssql_password: "p@55w0rD"
        mssql_edition: Evaluation
        mssql_tcp_port: "{{ __mssql_test_port }}"

    - name: >-
        Verify that the port is configured properly {{ __mssql_test_port }}
      include_tasks: tasks/verify_tcp_port.yml
      vars:
        __mssql_tcp_port_new: "{{ __mssql_test_port }}"
        __mssql_tcp_port_previous: 1433
