---

# Set ssh_sshd_config
- name: Collect OS-specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_os_family | lower }}.yml"
    - "{{ ansible_distribution | lower }}.yml"
    - default.yml

- name: Set sshd_config options (group)
  lineinfile:
    dest: "{{ ssh_config_dir }}/sshd_config"
    line: "{{ item.option }} {{ item.value }}"
    regexp: "^{{ item.option }} "
    state: present
    backup: yes
  with_flattened:
    - "{{ ssh_all_sshd_config }}"
    - "{{ ssh_group_sshd_config }}"
    - "{{ ssh_host_sshd_config }}"
  notify:
    - reload sshd

---

# Set ssh_sshd_config
- name: Collect OS-specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_os_family | lower }}.yml"
    - "{{ ansible_distribution | lower }}.yml"
    - default.yml

- name: Set sshd_config options (group)
  lineinfile:
    dest: "{{ ssh_config_dir }}/sshd_config"
    line: "{{ item.option }} {{ item.value }}"
    regexp: "^{{ item.option }} "
    state: present
    backup: yes
  with_inheritance_chain: sshd_config
  notify:
    - reload sshd

Use inheritance chain with the ssh config
Use inheritance chain with the ssh config
