mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
modern Ansible syntax in roles/sshd
This commit is contained in:
parent
84eea97af9
commit
ea6382c221
1 changed files with 13 additions and 10 deletions
|
@ -1,18 +1,21 @@
|
||||||
- name: Disable root login with password
|
- name: Disable root login with password
|
||||||
lineinfile: dest=/etc/ssh/sshd_config
|
lineinfile:
|
||||||
regexp='^PermitRootLogin'
|
dest: /etc/ssh/sshd_config
|
||||||
line='PermitRootLogin without-password'
|
regexp: '^PermitRootLogin'
|
||||||
state=present
|
line: 'PermitRootLogin without-password'
|
||||||
|
state: present
|
||||||
#TODO: use handler to reload ssh
|
#TODO: use handler to reload ssh
|
||||||
|
|
||||||
- name: Enable sshd
|
- name: Enable sshd
|
||||||
service: name={{ sshd_service }}
|
service:
|
||||||
enabled=yes
|
name: "{{ sshd_service }}"
|
||||||
state=started
|
enabled: yes
|
||||||
|
state: started
|
||||||
when: sshd_enabled
|
when: sshd_enabled
|
||||||
|
|
||||||
- name: Disable sshd
|
- name: Disable sshd
|
||||||
service: name={{ sshd_service }}
|
service:
|
||||||
enabled=no
|
name: "{{ sshd_service }}"
|
||||||
state=stopped
|
enabled: no
|
||||||
|
state: stopped
|
||||||
when: not sshd_enabled
|
when: not sshd_enabled
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue