-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh.yaml
50 lines (49 loc) · 1.24 KB
/
ssh.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
- hosts: all
tasks:
- name: required packages
pacman:
name: openssh
state: latest
- name: chattr -i /etc/ssh/sshd_config
file:
path: /etc/ssh/ssh_config
attributes: -i
- name: chattr -i /etc/ssh/ssh_config
file:
path: /etc/ssh/ssh_known_hosts
attributes: -i
- name: chattr -i /etc/ssh/ssh_known_hosts
file:
path: /etc/ssh/sshd_config
attributes: -i
- name: chattr -i /root/.ssh/authorized_keys
file:
path: /root/.ssh/authorized_keys
attributes: -i
- name: sshd_config
template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
attributes: +i
- name: enable/restart sshd
systemd:
state: restarted
enabled: yes
name: sshd
- name: ssh_config
template:
src: ssh_config.j2
dest: /etc/ssh/ssh_config
attributes: +i
- name: ssh_known_hosts
copy:
content: "{{ known_hosts }}"
dest: /etc/ssh/ssh_known_hosts
mode: '0644'
attributes: +i
- name: authorized_keys
copy:
content: "{{ authorized_keys }}"
dest: /root/.ssh/authorized_keys
mode: '0600'
attributes: +i