Allow passwordless sudo for ssh login user

This commit is contained in:
2020-01-04 11:39:24 +01:00
parent 4c979b88f5
commit 9c2c274d1b
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -26,6 +26,13 @@
append: yes
groups:
- sudo
- name: allow passwordless sudo for new user
template:
src: etc/sudoers.d/ssh_user.j2
dest: /etc/sudoers.d/{{ ssh_user }}
owner: root
group: root
mode: 0440
- name: add authorized key to SSH login user
authorized_key:
key: "{{ item }}"
@@ -41,13 +48,13 @@
path: /etc/ssh/sshd_config
line: 'PermitRootLogin no'
state: present
insertafter: EOF
insertafter: EOF
- name: disable password authentication
lineinfile:
path: /etc/ssh/sshd_config
line: 'PasswordAuthentication no'
state: present
insertafter: EOF
insertafter: EOF
- name: set modern host key
lineinfile:
dest: /etc/ssh/sshd_config