openshift-on-openstack icon indicating copy to clipboard operation
openshift-on-openstack copied to clipboard

We should create the SSH key for users or allow them to supply there own.

Open sferich888 opened this issue 8 years ago • 0 comments

We can create the SSH key for a user of the template, with the following template.

heat_template_version: 2014-10-16

description: A hot template for provisioning an SSH Key 

parameters:

  key_name:
    type: string
    default: "ssh_key"

  public_key:
    type: string
    default: ""

resources:
  ssh_key:
    type: OS::Nova::KeyPair
    properties:
      save_private_key: true
      name: {get_param: key_name}
      public_key: {get_param: public_key}

outputs:
  key_name:
    description: SSH Key Name
    value: { get_param: key_name}
  private_key:
    description: Private key
    value: { get_attr: [ ssh_key, private_key ] }

The main template can then create the key with something like:

  ssh_key:
    type: ssh_key.yaml             ### Denoted above
    #type: STACK::Resource::SSH_Key_Template
    properties:
      key_name: {get_param: ssh_key_name}
      public_key: {get_param: public_key}

Which can then be referenced by the following and not the parameter name.

      ssh_key_name: { get_attr: [ssh_key, key_name] }

Because the new key will get generated, if the public_key is not supplied, it simplifies the per-requisites, and still allows for the end user to supply a public key if they would like.

sferich888 avatar Apr 05 '16 13:04 sferich888