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

29 lines
626 B
YAML
Raw Normal View History

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