---
- name: Verify default packages as well as additional are installed
  hosts: all
  gather_facts: true
  vars:
    additional_package: >-
      {% if ansible_facts['distribution'] in [ 'RedHat', 'CentOS' ] and
            ansible_facts['distribution_version'] | int < 9 %}
        openssh-ldap
      {% elif ansible_facts['os_family'] == 'RedHat' %}
        openssh-keycat
      {% else %}
        openssh-tests
      {% endif %}
  tasks:
    - name: Run role
      include_role:
        name: linux-system-roles.ssh
      vars:
        ssh_additional_packages:
          - "{{ additional_package | trim }}"

    - name: Gather the package facts
      package_facts:

    - name: Verify the packages were installed
      assert:
        that:
          - additional_package | trim in ansible_facts.packages
