37 lines
853 B
YAML
37 lines
853 B
YAML
- name: Copy SSH config
|
|
template:
|
|
src: sshd.conf.j2
|
|
dest: /etc/ssh/sshd_config.d/sshd.conf
|
|
owner: 0
|
|
group: 0
|
|
mode: 0600
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------
|
|
|
|
- name: Restart SSH service
|
|
systemd:
|
|
name: ssh
|
|
enabled: true
|
|
state: restarted
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------
|
|
|
|
- name: Create .ssh directory if it doesn't exist
|
|
file:
|
|
path: "/home/{{ user }}/.ssh"
|
|
state: directory
|
|
mode: '0700'
|
|
owner: "1000"
|
|
group: "1000"
|
|
|
|
- name: Set permissions for authorized_keys
|
|
file:
|
|
path: "{{ ansible_env.HOME }}/.ssh/authorized_keys"
|
|
state: touch
|
|
mode: '0600'
|
|
owner: "1000"
|
|
group: "1000"
|
|
|
|
# stat -c "%a %n" .ssh/*
|
|
# ls -al .ssh
|