ansible/roles/openssh_server/tasks/main.yml

40 lines
828 B
YAML
Raw Normal View History

2021-12-12 05:56:26 +01:00
---
- name: Install OpenSSH server
apt:
name: openssh-server
- name: Enable OpenSSH Server
systemd:
2021-12-15 16:17:11 +01:00
name: ssh.service
2021-12-12 05:56:26 +01:00
enabled: true
state: started
- name: Install sshd configuration file
template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
owner: root
group: root
mode: u=r,g=,o=
validate: "/usr/sbin/sshd -tf %s"
notify: Restart sshd
- name: Install Users CA public key
copy:
2023-07-04 04:04:48 +02:00
content: "{{ openssh__users_ca_public_key }}"
2021-12-12 05:56:26 +01:00
dest: /etc/ssh/users_ca.pub
owner: root
group: root
mode: u=r,g=,o=
notify: Restart sshd
- name: Install authorized principals file
copy:
2023-07-04 04:04:48 +02:00
content: "{{ openssh__authorized_principals | join('\n') }}"
2021-12-12 05:56:26 +01:00
dest: /etc/ssh/authorized_principals
owner: root
group: root
mode: u=r,g=,o=
notify: Restart sshd
...