added ssh keys playbook

This commit is contained in:
2025-07-23 12:33:01 +02:00
parent 9776d873e9
commit f6fb2e6c85
2 changed files with 48 additions and 0 deletions

5
ssh-keys.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- hosts: all
become: true
tasks:
- import_tasks: tasks/general/ssh-keys.yml

View File

@@ -0,0 +1,43 @@
---
- name: Ensure the .ssh folder is present and has the right permissions
ansible.builtin.file:
path: ~/.ssh
mode: 0700
state: directory
###
# Current Keys
###
- name: Ensure the "bryanpedini@bryanbox.home.infra.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
mode: 0600
value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOuad05527ZlLMfVh9fOlDapVBdQ3dEAyoyZfNvoxqBQ bryanpedini@bryanbox.home.infra.bjphoster.cloud
state: present
create: true
- name: Ensure the "bryanpedini@acerlap.home.infra.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
mode: 0600
value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG91LScq6vrfBAKw0fph736ooWTqxsJkC6mK+UOAtmf9 bryanpedini@acerlap.home.infra.bjphoster.cloud
state: present
create: true
- name: Ensure the "bryanpedini@frameworkbryan.home.infra.bjphoster.cloud" key is present
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
mode: 0600
value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMQntI9yuNrcQHEoXvRQBcUyfGjWG9PYw6eQI3Zouyvr bryanpedini@frameworkbryan.home.infra.bjphoster.cloud
state: present
create: true
###
# Old Keys
###
- name: Ensure the "bryanpedini@bryanvostro.wimore.it" is absent
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMUyzqBkMgVhDLfbegGaBLyWDyd7jNcoXvy1EagYXzDz bryanpedini@bryanvostro.wimore.it
state: absent
- name: Ensure the "bryanpedini@bryanbox.home.bjphoster.cloud" is absent
ansible.builtin.lineinfile:
path: ~/.ssh/authorized_keys
value: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF6KIOHTpybQPsEwCftOr9+43s1Br/PNjcGg24NboVh2 bryanpedini@bryanbox.home.bjphoster.cloud
state: absent