ansible-roles/system/base/sshd/tasks/main.yml

29 lines
623 B
YAML

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