added sshd config playbook

This commit is contained in:
2025-01-31 16:11:05 +01:00
parent 15a48010b1
commit 19d725a920
2 changed files with 22 additions and 0 deletions

9
sshd-config.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- hosts: all
become: true
tasks:
- import_tasks: tasks/general/sshd-config.yml
- import_tasks: tasks/debian-general/restart-ssh-service.yml
when: ansible_facts["os_family"] == "Debian"
- import_tasks: tasks/rhel-general/restart-ssh-service.yml
when: ansible_facts["os_family"] == "RedHat"

View File

@@ -0,0 +1,13 @@
---
- name: Ensure the TCPKeepAlive option is uncommented and set to yes
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#?TCPKeepAlive"
line: "TCPKeepAlive yes"
state: present
- name: Ensure the ClientAliveInterval option is uncommented and set to 10 seconds
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#?ClientAliveInterval"
line: "ClientAliveInterval 10"
state: present