--- - name: Put authorized keys template: src: files/auth_keys dest: /etc/ssh/auth_keys - name: Put sshd config template: src: files/sshd_config dest: /etc/ssh/sshd_config notify: Reload sshd - name: Set different SSH port lineinfile: dest: /etc/ssh/sshd_config state: present regexp: '^Port' line: 'Port 6666' validate: 'sshd -t -f %s' notify: Reload sshd when: "'publicservices' in group_names"