feat: add public ssh_key

main
Winston Smith 2022-12-08 10:20:46 +01:00
parent 7c56c3268d
commit 6262344743
No known key found for this signature in database
GPG Key ID: DFD784DB2A6F7A07
2 changed files with 12 additions and 0 deletions

View File

@ -1,4 +1,5 @@
- hosts: debian_servers
become: true
tasks:
- name: Update and upgrade apt packages
@ -50,3 +51,8 @@
- docker-registry
state: latest
update_cache: true
- name: Install public ssh key for user
lineinfile:
path: "/home/{{ ansible_user }}/.ssh/authorized_keys"
line: "{{ ssh_pubkey }}"

6
inventory.example.yml Normal file
View File

@ -0,0 +1,6 @@
[debian_servers]
<hosts>
[debian_servers:vars]
ansible_user=<ssh_user>
ansible_ssh_private_key_file=<ssh_private_key>
ssh_pubkey="<ssh_public_key_to_copy>"