37 lines
779 B
YAML
37 lines
779 B
YAML
|
---
|
||
|
- hosts: all
|
||
|
become: true
|
||
|
tasks:
|
||
|
- name: Install ssh
|
||
|
apt:
|
||
|
name: openssh-server
|
||
|
state: present
|
||
|
update_cache: yes
|
||
|
- name: Copy sshd_config
|
||
|
template:
|
||
|
src: sshd_config
|
||
|
dest: /etc/ssh/sshd_config
|
||
|
- name: Copy config
|
||
|
file:
|
||
|
src: sshd_config
|
||
|
path: /etc/ssh/sshd_config
|
||
|
state: file
|
||
|
owner: root
|
||
|
group: root
|
||
|
- name: Copy authorized keys
|
||
|
template:
|
||
|
src: authorized_keys
|
||
|
dest: /etc/ssh/authorized_keys
|
||
|
- name: Setup authorized keys
|
||
|
file:
|
||
|
src: authorized_keys
|
||
|
path: /etc/ssh/authorized_keys
|
||
|
state: file
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: 777
|
||
|
- name: Restart sshd
|
||
|
service:
|
||
|
name: sshd
|
||
|
state: restarted
|