--- - include_tasks: versioncheck.yml when: submodules_versioncheck|bool - name: Gather the package facts package_facts: manager: auto - include_tasks: packages.yml - name: set sshd_service variable block: - name: read os specific variable include_vars: "vars/sshd_{{ ansible_distribution | lower }}.yml" rescue: - name: read default variable include_vars: vars/sshd_default.yml - name: Collect all users and groups allowed to login via ssh set_fact: sshd__allowed_users: '{{ sshd__allowed_users + users.keys() | default({}) | sort }}' sshd__allowed_groups: '{{ sshd__allowed_groups + users.keys() | default({}) | sort }}' - name: "get package version of {{ sshd__package }}" debug: msg: "{{ ansible_facts.packages[sshd__package][0].version }}" when: "'{{ sshd__package }}' in ansible_facts.packages" - include_tasks: keys.yml - name: Copy sshd configuration become: yes template: src: sshd_config.j2 dest: '/etc/ssh/sshd_config' owner: root group: root mode: 'u=rw,g=r,o=r' validate: /usr/sbin/sshd -t -f %s backup: yes notify: - systemctl restart ssh