1
0
mirror of https://github.com/gjkcz/ansible-void.git synced 2025-06-19 19:00:34 +02:00

Create role for SSH

This commit is contained in:
2024-12-04 11:04:12 +01:00
parent 9a0892c9b4
commit 78f53019c5
4 changed files with 26 additions and 29 deletions

View File

@ -0,0 +1,3 @@
ssh_user: root
ssh_dir: /root/.ssh
ssh_keys: []

14
roles/ssh/tasks/main.yaml Normal file
View File

@ -0,0 +1,14 @@
- name: Ensure SSH directory exists
file:
path: "{{ ssh_dir }}"
state: directory
owner: "{{ ssh_user }}"
group: "{{ ssh_user }}"
mode: 0700
- name: Import SSH keys
authorized_key:
user: "{{ ssh_user }}"
key: "{{ item }}"
state: present
loop: "{{ ssh_keys }}"