add support for ssh keypairs
Change-Id: Idf34efddd04862b9a840ce4fa3023f1126779215 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
96b98d0293
commit
d37455e88a
|
@ -1,3 +1,5 @@
|
||||||
# Resource file for downpour using the instance created in tiny.yml.
|
# Resource file for downpour using the instance created in tiny.yml.
|
||||||
servers:
|
servers:
|
||||||
- name: downpour-demo-tiny
|
- name: downpour-demo-tiny
|
||||||
|
keypairs:
|
||||||
|
- name: downpour-demo
|
|
@ -42,6 +42,10 @@ def export_data(cloud, config, args):
|
||||||
# automatically.
|
# automatically.
|
||||||
to_export = resources.load(args.resource_file)
|
to_export = resources.load(args.resource_file)
|
||||||
|
|
||||||
|
for keypair_info in to_export.keypairs:
|
||||||
|
keypair = cloud.get_keypair(keypair_info.name)
|
||||||
|
tasks.extend(res.keypair(keypair))
|
||||||
|
|
||||||
for image_info in to_export.images:
|
for image_info in to_export.images:
|
||||||
image = cloud.get_image(image_info.name)
|
image = cloud.get_image(image_info.name)
|
||||||
tasks.extend(res.image(image))
|
tasks.extend(res.image(image))
|
||||||
|
|
|
@ -61,6 +61,22 @@ class Resolver:
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def keypair(self, keypair):
|
||||||
|
if ('keypair', keypair.name) in self._memo:
|
||||||
|
return
|
||||||
|
self._memo.add(('keypair', keypair.name))
|
||||||
|
yield {
|
||||||
|
'name': 'Add public key {}'.format(keypair.name),
|
||||||
|
'os_keypair': {
|
||||||
|
'name': keypair.name,
|
||||||
|
'public_key': keypair.public_key,
|
||||||
|
},
|
||||||
|
'register': self._mk_var_name('key'),
|
||||||
|
}
|
||||||
|
yield self._map_uuids(
|
||||||
|
'keypair', keypair.name, keypair.id, 'key.id',
|
||||||
|
)
|
||||||
|
|
||||||
def security_group(self, group):
|
def security_group(self, group):
|
||||||
if ('security_group', group.id) in self._memo:
|
if ('security_group', group.id) in self._memo:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue