From 7d534a4e8d4c3042b55518405ac891ec9f09ed9b Mon Sep 17 00:00:00 2001 From: Chris Hultin Date: Fri, 10 Jun 2016 10:39:11 -0500 Subject: [PATCH] Adding ability to set 'properties' via Glance The 'Glance' plugin lacked the ability to set properties on the images that were created via the plugin. This patch adds that ability. Change-Id: If2c73050ed8335b3a22b79bb7ce28189de046427 --- library/glance | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/glance b/library/glance index bebcd95..87d630e 100644 --- a/library/glance +++ b/library/glance @@ -57,6 +57,9 @@ options: choices: - true (public) - false (private) + image_properties: + description: + - List of properties and their values api_version: description: - which version of the glance api to use @@ -85,6 +88,7 @@ EXAMPLES = """ image_container_format: bare image_disk_format: qcow2 image_is_public: True + image_properties: { "os_distro": "cirros" } # Get facts about existing images - name: Get image facts @@ -183,7 +187,8 @@ class ManageGlance(object): name=image_name, disk_format=p['image_disk_format'], container_format=p['image_container_format'], - copy_from=p['image_url'] + copy_from=p['image_url'], + properties=p['image_properties'] ) if v == '1': image_opts['is_public'] = p['image_is_public'] @@ -223,6 +228,7 @@ def main(): image_container_format=dict(required=False), image_disk_format=dict(required=False), image_is_public=dict(required=False, type='bool'), + image_properties=dict(required=False), api_version=dict(default='1', required=False, choices=['1', '2']), insecure=dict(default=False, required=False, type='bool') ),