From 94ca22734d1f299e568e20ba3cd08a154e7da312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavi=20Lle=C3=B3=20Tom=C3=A1s?= Date: Thu, 10 Oct 2024 15:48:34 +0200 Subject: [PATCH] Refs #8025 Rol debian-base. Task ssh to conf.d directory --- roles/debian-base/tasks/ssh.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/roles/debian-base/tasks/ssh.yml b/roles/debian-base/tasks/ssh.yml index 0fb844b..1ff39a2 100644 --- a/roles/debian-base/tasks/ssh.yml +++ b/roles/debian-base/tasks/ssh.yml @@ -5,13 +5,17 @@ size: 4096 register: new_pair - name: Configure sshd_config settings - lineinfile: - path: /etc/ssh/sshd_config - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - loop: - - { regexp: '^#ListenAddress 0.0.0.0', line: 'ListenAddress 0.0.0.0' } - - { regexp: '^#SyslogFacility AUTH', line: 'SyslogFacility AUTH' } + copy: + dest: /etc/ssh/sshd_config.d/custom.conf + content: | + # Do not edit this file! Ansible will overwrite it. + + ListenAddress 0.0.0.0 + SyslogFacility AUTH + permitRootLogin yes + owner: root + group: root + mode: '0644' - name: Delete old host SSH keys file: path: "{{ item }}"