--- # Include variables and define needed variables. - name: Include OS-specific variables. include_vars: "{{ item }}" with_first_found: - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml" - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" # Setup/install tasks. - include: setup-RedHat.yml when: ansible_os_family in ['RedHat', 'Rocky'] - include: setup-Debian.yml when: ansible_os_family == 'Debian' - include: setup-Alpine.yml when: ansible_os_family == 'Alpine' - include: setup-Suse.yml when: ansible_os_family == 'Suse' - include: setup-Windows.yml when: ansible_os_family == "Windows" - name: Set up authorized_keys for the root user authorized_key: user: 'root' key: "{% for key in query('fileglob', 'public_keys/*.pub') %}{{ lookup('file', key) ~ '\n'}}{% endfor %}\n{% for key in lookup('vars', 'extra_root_ssh_authorized_keys', default=[]) %}{{ key ~ '\n' }}{% endfor %}" exclusive: true when: ansible_os_family != 'Windows' - include: users-Windows.yml when: ansible_os_family == "Windows" - include: users.yml when: ansible_os_family != "Windows"