Initial commit, needs service name as variable
This commit is contained in:
commit
6f93842670
18
tasks/main.yml
Normal file
18
tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: "Set «PermitRootLogin» to «without-password»"
|
||||
lineinfile:
|
||||
dest: /etc/ssh/sshd_config
|
||||
regexp: '^#? *PermitRootLogin'
|
||||
line: "PermitRootLogin without-password"
|
||||
backup: yes
|
||||
register: sshconfigchanged
|
||||
|
||||
|
||||
- name: Restart sshd
|
||||
service:
|
||||
name: "{{ ssh_service_name }}"
|
||||
state: restarted
|
||||
sleep: 5
|
||||
when: sshconfigchanged is changed
|
||||
|
||||
|
Loading…
Reference in a new issue