diff options
author | Artem Goncharov <Artem.goncharov@gmail.com> | 2019-04-04 19:16:48 +0200 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-04-04 19:16:48 +0200 |
commit | d0745ed6a27ef8f52d46459d5de772b099a3b189 (patch) | |
tree | dec4f7b81bb041e8af62b96a0d7e4d89acfa0ba8 | |
parent | optionally get service account file path from env var (#54407) (diff) | |
download | ansible-d0745ed6a27ef8f52d46459d5de772b099a3b189.tar.xz ansible-d0745ed6a27ef8f52d46459d5de772b099a3b189.zip |
add support for specifying volume metadata (#48081)
add possibility to specify metadata (properties) to be set on the volume
-rw-r--r-- | lib/ansible/modules/cloud/openstack/os_volume.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ansible/modules/cloud/openstack/os_volume.py b/lib/ansible/modules/cloud/openstack/os_volume.py index 8d84b2eb7b..0d9705b8b1 100644 --- a/lib/ansible/modules/cloud/openstack/os_volume.py +++ b/lib/ansible/modules/cloud/openstack/os_volume.py @@ -58,6 +58,10 @@ options: description: - Scheduler hints passed to volume API in form of dict version_added: "2.4" + metadata: + description: + - Metadata for the volume + version_added: "2.8" requirements: - "python >= 2.7" - "openstacksdk" @@ -125,6 +129,9 @@ def _present_volume(module, cloud): if module.params['scheduler_hints']: volume_args['scheduler_hints'] = module.params['scheduler_hints'] + if module.params['metadata']: + volume_args['metadata'] = module.params['metadata'] + volume = cloud.create_volume( wait=module.params['wait'], timeout=module.params['timeout'], **volume_args) @@ -154,7 +161,8 @@ def main(): snapshot_id=dict(default=None), volume=dict(default=None), state=dict(default='present', choices=['absent', 'present']), - scheduler_hints=dict(default=None, type='dict') + scheduler_hints=dict(default=None, type='dict'), + metadata=dict(default=None, type='dict') ) module_kwargs = openstack_module_kwargs( mutually_exclusive=[ |