main.yml 373 B

123456789101112131415161718
  1. ---
  2. - name: "Set «PermitRootLogin» to «without-password»"
  3. lineinfile:
  4. dest: /etc/ssh/sshd_config
  5. regexp: '^#? *PermitRootLogin'
  6. line: "PermitRootLogin without-password"
  7. backup: yes
  8. register: sshconfigchanged
  9. - name: Restart sshd
  10. service:
  11. name: "{{ ssh_service_name }}"
  12. state: restarted
  13. sleep: 5
  14. when: sshconfigchanged is changed