Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to read attributes of existing keypair in Heat template

cli:

[root@localhost ~(keystone_admin)]# nova keypair-list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| ssh_key | 8c:f1:b1:ab:c1:5f:6e:86:45:e1:35:2a:20:fc:34:d1 |
+-------+-------------------------------------------------+

yaml:

...
  server1:
    type: OS::Nova::Server
    properties:
      name: abc1
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks:
        - port: { get_resource: server1_port1 }
      user_data:
        str_replace:
          template: |
            ssh-key:$ssh_keys
      params:
        $ssh_key:                { get_attr: [ssh_key, public_key] }

Is it possible to "get_attr" from resource which is not defined in same yaml? Above example is not working. (Nova keypair is not defined in the yaml.)

How to read attributes of existing keypair in Heat template

cli:

[root@localhost ~(keystone_admin)]# nova keypair-list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| ssh_key | 8c:f1:b1:ab:c1:5f:6e:86:45:e1:35:2a:20:fc:34:d1 |
+-------+-------------------------------------------------+

yaml:

...
  server1:
    type: OS::Nova::Server
    properties:
      name: abc1
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks:
        - port: { get_resource: server1_port1 }
      user_data:
        str_replace:
          template: |
            ssh-key:$ssh_keys
      params:
        $ssh_key:                { get_attr: [ssh_key, public_key] }

Is it possible to "get_attr" from resource which is not defined in same yaml? Above example is not working. (Nova keypair is not defined in the yaml.)yaml. Keypair created from cli before stack creation, nova keypair-add...)