ansible-edda/plays/roles/system_base/tasks/include/sshd.yml

28 lines
613 B
YAML

# SSH must be installed so we don't bother with installing it.
- name: "sshd : configure sshd"
ansible.builtin.template:
src: "./sshd/99-local.conf.j2"
dest: "/etc/ssh/sshd_config.d/99-local.conf"
mode: 0600
register: sshd_conf
- name: "sshd : enable sshd"
ansible.builtin.systemd:
name: "sshd"
enabled: true
- name: "sshd : start sshd"
ansible.builtin.systemd:
name: "sshd"
state: "started"
register: sshd_start
- name: "sshd : restart sshd"
ansible.builtin.systemd:
name: "sshd"
state: "restarted"
when:
sshd_conf.changed and
not sshd_start.changed