fixup! Per Device SSH-Keys
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e6255c76e3
commit
6976503097
@ -18,18 +18,15 @@
|
|||||||
become: false
|
become: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: pubkey
|
register: pubkey
|
||||||
community.crypto.openssl_publickey:
|
ansible.builtin.command:
|
||||||
format: OpenSSH
|
cmd: "ssh-keygen -y -f {{ ansible_ssh_private_key_file }}"
|
||||||
path: "/tmp/{{ inventory_hostname }}.pub"
|
|
||||||
privatekey_path: "{{ ansible_ssh_private_key_file }}"
|
|
||||||
return_content: true
|
|
||||||
- name: Deploy Machine SSH-Key
|
- name: Deploy Machine SSH-Key
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: "{{ ansible_user }}"
|
user: "{{ ansible_user }}"
|
||||||
state: present
|
state: present
|
||||||
manage_dir: false
|
manage_dir: false
|
||||||
path: "/etc/ssh/authorized_keys/{{ ansible_user }}"
|
path: "/etc/ssh/authorized_keys/{{ ansible_user }}"
|
||||||
key: "{{ pubkey.publickey }} drone-machine-deploy"
|
key: "{{ pubkey.stdout }}"
|
||||||
- name: Deploy Common SSH-Keys
|
- name: Deploy Common SSH-Keys
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: "{{ ansible_user }}"
|
user: "{{ ansible_user }}"
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
---
|
---
|
||||||
- name: Generate SSH Keys
|
- name: Generate SSH Keys
|
||||||
hosts: all
|
hosts: all
|
||||||
|
serial: 1
|
||||||
tasks:
|
tasks:
|
||||||
- name: Check for ssh key present
|
- name: Check for ssh key present
|
||||||
shell: "passage machine/{{ inventory_hostname }}/ssh_key"
|
shell: "passage machine/{{ inventory_hostname }}/ssh_key"
|
||||||
@ -10,7 +11,7 @@
|
|||||||
failed_when: false
|
failed_when: false
|
||||||
changed_when: false
|
changed_when: false
|
||||||
- name: Generate ssh_key
|
- name: Generate ssh_key
|
||||||
shell: "openssl genpkey -algorithm ed25519 | passage insert --multiline machine/{{ inventory_hostname }}/ssh_key"
|
shell: "( exec 3>&1 ; ssh-keygen -qt ed25519 -f /proc/self/fd/3 <<<y >/dev/null 2>&1 ) | passage insert --multiline machine/{{ inventory_hostname }}/ssh_key"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: ssh_key.rc != 0
|
when: ssh_key.rc != 0
|
||||||
register: new_ssh_key
|
register: new_ssh_key
|
||||||
|
Loading…
Reference in New Issue
Block a user