Ensure that ssh is installed (#774)

Signed-off-by: Sevan Murriguian-Watrin <[email protected]>
This commit is contained in:
Sevan authored and GitHub committed 2024-07-02 20:41:07 +02:00
1 parent ed85a70105
commit 0233bfe543
16 files changed
+53 -15

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
---
- name: Install openssh package(s)
ansible.builtin.package:
name: "{{ pkg }}"
state: present
loop: "{{ ssh_pkgs }}"
loop_control:
loop_var: pkg
# see https://github.com/dev-sec/ansible-collection-hardening/issues/763
- name: Change Debian/Ubuntu systems so ssh starts traditionally instead of socket-activated
ansible.builtin.include_tasks: disable-systemd-socket.yml
when:
- ssh_server_hardening | bool
- ssh_server_enabled | bool
- (ansible_facts.distribution == 'Ubuntu' and ansible_facts.distribution_major_version is version('22.04', '>=')) or
(ansible_facts.os_family == 'Debian' and ansible_facts.distribution_major_version is version('12', '>='))
- name: Enable or disable sshd service
ansible.builtin.service:
name: "{{ sshd_service_name }}"
enabled: "{{ ssh_server_service_enabled }}"