ansible-edda/playbooks/system/roles/base/tasks/include/sshd.yml

28 lines
661 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: system_base_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: system_base_sshd_start
- name: "sshd : restart sshd"
ansible.builtin.systemd:
name: "sshd"
state: "restarted"
when:
system_base_sshd_conf.changed and
not system_base_sshd_start.changed