editing sshd and add public keys
This commit is contained in:
@@ -3,6 +3,31 @@
|
||||
template:
|
||||
src: files/sshd_config
|
||||
dest: /etc/ssh/sshd_config
|
||||
|
||||
- name: Disable empty password login
|
||||
lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: "^#?PermitEmptyPasswords"
|
||||
line: "PermitEmptyPasswords no"
|
||||
|
||||
- name: Disable remote root login
|
||||
lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: "^#?PermitRootLogin"
|
||||
line: "PermitRootLogin no"
|
||||
|
||||
- name: Add public key for deploy user
|
||||
authorized_key:
|
||||
user: "{{ deploy_user.username }}"
|
||||
key: "{{ deploy_public_key }}"
|
||||
register: add_identity_key
|
||||
|
||||
- name: Disable password login
|
||||
lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: "^#?PasswordAuthentication"
|
||||
line: "PasswordAuthentication no"
|
||||
when: add_identity_key|success and not add_identity_key|skipped
|
||||
notify: restart sshd
|
||||
|
||||
- name: Enable SSH daemon
|
||||
|
Reference in New Issue
Block a user