Skip to content

Commit

Permalink
Fix SSH keys template
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Oct 11, 2024
1 parent 8372be5 commit 3724b39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions artifacts/add_ssh_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
vars:
username: "{{ user | default(ansible_user) }}"
tasks:
- name: Split the ssh_key into a list
set_fact:
ssh_keys: "{{ ssh_key.replace('\r', '').split('\n') }}"

- name: Add the authorized_key to the nodes
authorized_key:
user: "{{ username }}"
Expand Down
17 changes: 8 additions & 9 deletions templates/ssh_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ imports:
description: Add a set of SSH Public Keys to the VMs

metadata:
template_version: "1.0.1"
template_version: "1.0.0"
template_name: SSH Keys
display_name: Add a set of SSH Public Keys
icon: images/ssh-icon.png
Expand All @@ -16,18 +16,17 @@ metadata:
- simple-node-disk.yml
tabs:
SSH Data:
- ssh_keys
- ssh_key:
tag_type: textarea

topology_template:

inputs:

ssh_keys:
type: list
entry_schema:
type: string
description: SSH Keys to inject to the VM
default: []
ssh_key:
type: string
description: SSH Key/s to inject to the VM (leave empty line to separate keys)
default: ''

node_templates:

Expand All @@ -40,4 +39,4 @@ topology_template:
configure:
implementation: https://raw.githubusercontent.com/grycap/tosca/main/artifacts/add_ssh_key.yml
inputs:
ssh_keys: { get_input: ssh_keys }
ssh_key: { get_input: ssh_key }

0 comments on commit 3724b39

Please sign in to comment.