diff --git a/artifacts/add_ssh_key.yml b/artifacts/add_ssh_key.yml index 24854e9..5dfac86 100644 --- a/artifacts/add_ssh_key.yml +++ b/artifacts/add_ssh_key.yml @@ -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 }}" diff --git a/templates/ssh_keys.yml b/templates/ssh_keys.yml index 7fdb779..ca12666 100644 --- a/templates/ssh_keys.yml +++ b/templates/ssh_keys.yml @@ -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 @@ -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: @@ -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 }