migrate ssh config in system

This commit is contained in:
vincent 2020-03-02 21:19:09 +01:00
parent dbd6c49507
commit 0593bc7705
2 changed files with 22 additions and 1 deletions

View File

@ -10,4 +10,5 @@
pacman: update_cache=yes pacman: update_cache=yes
- name: Restart sshd - name: Restart sshd
service: name=sshd state=restarted service: name=sshd state=restarted
become: yes

View File

@ -31,3 +31,23 @@
user: "{{user.name}}" user: "{{user.name}}"
key: "{{ keystodeploy|map(attribute='sshkey')|join('\n') }}" key: "{{ keystodeploy|map(attribute='sshkey')|join('\n') }}"
exclusive: true exclusive: true
- name : les connexions par mot de passe sont désactivées
become: yes
lineinfile :
dest: /etc/ssh/sshd_config
regexp: "^#?PasswordAuthentication"
line: "PasswordAuthentication no"
state: present
notify: Restart sshd
- name: Remove root SSH access
become: yes
lineinfile:
dest: /etc/ssh/sshd_config
regexp: "^PermitRootLogin"
line: "PermitRootLogin no"
state: present
notify: Restart sshd