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

29 lines
632 B
YAML
Raw Normal View History

2022-12-18 23:43:40 +01:00
---
# SSH must be installed so we don't bother with installing it.
2022-12-20 17:31:37 +01:00
- name: "configure sshd"
ansible.builtin.template:
2022-12-20 17:31:37 +01:00
src: "./99-local.conf.j2"
dest: "/etc/ssh/sshd_config.d/99-local.conf"
mode: 0600
2022-12-08 23:19:54 +01:00
register: system_base_sshd_conf
2022-12-20 17:31:37 +01:00
- name: "enable sshd"
ansible.builtin.systemd:
name: "sshd"
enabled: true
2022-12-20 17:31:37 +01:00
- name: "start sshd"
ansible.builtin.systemd:
name: "sshd"
state: "started"
2022-12-08 23:19:54 +01:00
register: system_base_sshd_start
2022-12-20 17:31:37 +01:00
- name: "restart sshd"
ansible.builtin.systemd:
name: "sshd"
state: "restarted"
when:
2022-12-08 23:19:54 +01:00
system_base_sshd_conf.changed and
not system_base_sshd_start.changed