1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/sshd/tasks/main.yml

47 lines
926 B
YAML
Raw Normal View History

2019-01-02 02:44:19 +00:00
- name: Install ssh daemon
package:
name: "{{ sshd_package }}"
state: present
when: sshd_enabled
- name: Disable root login with password
2018-09-20 00:44:42 +00:00
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PermitRootLogin'
line: 'PermitRootLogin without-password'
state: present
2017-05-27 18:09:50 +00:00
#TODO: use handler to reload ssh
2018-09-20 00:55:28 +00:00
- name: Create root .ssh
file:
path: /root/.ssh
owner: root
group: root
mode: 0700
state: directory
when: sshd_enabled
- name: Install dummy root keys as placeholder
copy:
src: dummy_authorized_keys
dest: /root/.ssh/authorized_keys
owner: root
group: root
mode: 0600
force: no
when: sshd_enabled
2018-09-20 00:47:46 +00:00
- name: Enable & start sshd
2018-09-20 00:44:42 +00:00
service:
name: "{{ sshd_service }}"
enabled: yes
state: started
2017-05-27 18:09:50 +00:00
when: sshd_enabled
- name: Disable sshd
2018-09-20 00:44:42 +00:00
service:
name: "{{ sshd_service }}"
enabled: no
state: stopped
2017-05-27 18:09:50 +00:00
when: not sshd_enabled