adding ssh role

This commit is contained in:
2021-03-03 14:50:59 +00:00
parent ac93027a7d
commit 569f14ea1a
2 changed files with 24 additions and 0 deletions

19
roles/ssh/tasks/main.yml Normal file
View File

@@ -0,0 +1,19 @@
---
- name: Configure SSH access
tags: [ssh, server]
become: true
block:
- name: Remove any PermitRootLogin instruction
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PermitRootLogin"
state: absent
notify: restart ssh
- name: Disable SSH root login
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PermitRootLogin"
line: "PermitRootLogin prohibit-password"
state: present
notify: restart ssh