diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2023-01-14 19:02:36 +0100 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2023-04-02 11:45:09 +0200 |
commit | 5d019d2ad90c39cfae2d7edf0208c98060ddbd8e (patch) | |
tree | 9ba7c79b2341b0dc39ce88c221abdeacfc74e2fd /roles/sshd/tasks | |
parent | 5582074f59640eaad0b879c7c3b45bc3b0beefc8 (diff) | |
download | rules-5d019d2ad90c39cfae2d7edf0208c98060ddbd8e.tar.gz |
feat(roles/sshd): add argument specs
Diffstat (limited to 'roles/sshd/tasks')
-rw-r--r-- | roles/sshd/tasks/main.yml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/roles/sshd/tasks/main.yml b/roles/sshd/tasks/main.yml index b895958..6a622d2 100644 --- a/roles/sshd/tasks/main.yml +++ b/roles/sshd/tasks/main.yml @@ -9,15 +9,26 @@ - name: generate sshd configuration ansible.builtin.template: src: sshd_config.j2 - dest: /etc/ssh/sshd_config + dest: "{{ sshd_configuration_file }}" owner: 0 group: 0 mode: "0644" + register: sshd_result_generate_configuration -- name: enable and restart sshd +- name: lint sshd configuration + ansible.builtin.command: "sshd -tf {{ sshd_configuration_file }}" + register: sshd_result_lint + changed_when: false + +- name: restart sshd # noqa: no-handler ansible.builtin.service: name: sshd state: restarted + when: sshd_result_generate_configuration.changed + +- name: enable sshd + ansible.builtin.service: + name: sshd enabled: true - name: check ssh connection |