1
0
Fork 0
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:
A Holt 2018-09-19 20:44:42 -04:00 committed by GitHub
parent 84eea97af9
commit ea6382c221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,18 +1,21 @@
- name: Disable root login with password
lineinfile: dest=/etc/ssh/sshd_config
regexp='^PermitRootLogin'
line='PermitRootLogin without-password'
state=present
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PermitRootLogin'
line: 'PermitRootLogin without-password'
state: present
#TODO: use handler to reload ssh
- name: Enable sshd
service: name={{ sshd_service }}
enabled=yes
state=started
service:
name: "{{ sshd_service }}"
enabled: yes
state: started
when: sshd_enabled
- name: Disable sshd
service: name={{ sshd_service }}
enabled=no
state=stopped
service:
name: "{{ sshd_service }}"
enabled: no
state: stopped
when: not sshd_enabled