Compare commits
2 commits
ac52a8d2ca
...
d0896b2acc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d0896b2acc | ||
![]() |
318af615c0 |
3 changed files with 23 additions and 5 deletions
4
ansible/roles/server_bootstrap/meta/main.yml
Normal file
4
ansible/roles/server_bootstrap/meta/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
dependencies:
|
||||
- role: server_install_ssh
|
||||
- role: server_install_fail2ban
|
||||
- role: server_install_syslog
|
|
@ -2,7 +2,7 @@
|
|||
ssh_user: skulladmin
|
||||
|
||||
# Platzhalter-Key
|
||||
ssh_public_key: ""
|
||||
ssh_auth_keys_url: "https://skulldev.de/Skull-IT/trusted-ssh-keys/raw/branch/main/trusted-ssh-keys"
|
||||
|
||||
# SSH-Port
|
||||
ssh_port: 22
|
||||
|
|
|
@ -28,10 +28,24 @@
|
|||
group: "{{ ssh_user }}"
|
||||
mode: '0700'
|
||||
|
||||
- name: SSH-Key eintragen
|
||||
ansible.builtin.copy:
|
||||
content: "{{ ssh_public_key }}"
|
||||
dest: "/home/{{ ssh_user }}/.ssh/authorized_keys"
|
||||
- name: Trusted SSH keys von GitHub laden
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ ssh_auth_keys_url }}"
|
||||
dest: "/home/{{ ssh_user }}/.ssh/trusted_ssh_keys"
|
||||
owner: "{{ ssh_user }}"
|
||||
group: "{{ ssh_user }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Alle geladenen Keys in authorized_keys eintragen
|
||||
ansible.builtin.command: >
|
||||
bash -c "cat /home/{{ ssh_user }}/.ssh/trusted_ssh_keys >> /home/{{ ssh_user }}/.ssh/authorized_keys"
|
||||
args:
|
||||
creates: "/home/{{ ssh_user }}/.ssh/authorized_keys"
|
||||
become: true
|
||||
|
||||
- name: Permissions für authorized_keys setzen
|
||||
ansible.builtin.file:
|
||||
path: "/home/{{ ssh_user }}/.ssh/authorized_keys"
|
||||
owner: "{{ ssh_user }}"
|
||||
group: "{{ ssh_user }}"
|
||||
mode: '0600'
|
||||
|
|
Loading…
Add table
Reference in a new issue