Browse Source

migrate ssh config in system

master
vincent 2 years ago
parent
commit
0593bc7705
  1. 3
      handlers/main.yml
  2. 20
      tasks/ssh.yml

3
handlers/main.yml

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

20
tasks/ssh.yml

@ -31,3 +31,23 @@
user: "{{user.name}}"
key: "{{ keystodeploy|map(attribute='sshkey')|join('\n') }}"
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
Loading…
Cancel
Save