hcloud_volume: add linux_device to return values (#62865)
This commit is contained in:
parent
88a2778c60
commit
c724aa22bf
4 changed files with 21 additions and 0 deletions
|
@ -130,6 +130,12 @@ hcloud_volume:
|
|||
type: int
|
||||
returned: Always
|
||||
sample: 1337
|
||||
linux_device:
|
||||
description: Path to the device that contains the volume.
|
||||
returned: always
|
||||
type: src
|
||||
sample: /dev/disk/by-id/scsi-0HC_Volume_12345
|
||||
version_added: "2.10"
|
||||
location:
|
||||
description: Location name where the volume is located at
|
||||
type: string
|
||||
|
@ -178,6 +184,7 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
"location": to_native(self.hcloud_volume.location.name),
|
||||
"labels": self.hcloud_volume.labels,
|
||||
"server": to_native(server_name),
|
||||
"linux_device": to_native(self.hcloud_volume.linux_device),
|
||||
}
|
||||
|
||||
def _get_volume(self):
|
||||
|
|
|
@ -73,6 +73,12 @@ hcloud_volume_info:
|
|||
returned: always
|
||||
type: str
|
||||
sample: 10
|
||||
linux_device:
|
||||
description: Path to the device that contains the volume.
|
||||
returned: always
|
||||
type: src
|
||||
sample: /dev/disk/by-id/scsi-0HC_Volume_12345
|
||||
version_added: "2.10"
|
||||
location:
|
||||
description: Name of the location where the volume resides in
|
||||
returned: always
|
||||
|
@ -119,6 +125,7 @@ class AnsibleHcloudVolumeInfo(Hcloud):
|
|||
"location": to_native(volume.location.name),
|
||||
"labels": volume.labels,
|
||||
"server": to_native(server_name),
|
||||
"linux_device": to_native(volume.linux_device),
|
||||
})
|
||||
|
||||
return tmp
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
- volume.hcloud_volume.location == "fsn1"
|
||||
- volume.hcloud_volume.size == 10
|
||||
- volume.hcloud_volume.server != "{{hcloud_server_name}}"
|
||||
- volume.hcloud_volume.linux_device is defined
|
||||
|
||||
- name: test create volume idempotence
|
||||
hcloud_volume:
|
||||
|
|
|
@ -26,9 +26,15 @@
|
|||
check_mode: yes
|
||||
|
||||
- name: verify test gather hcloud volume infos in check mode
|
||||
vars:
|
||||
volume: "{{ hcloud_volume.hcloud_volume_info|selectattr('name','equalto',hcloud_volume_name) | first }}"
|
||||
assert:
|
||||
that:
|
||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
||||
- volume.name == "{{hcloud_volume_name}}"
|
||||
- volume.location == "fsn1"
|
||||
- volume.size == 10
|
||||
- volume.linux_device is defined
|
||||
|
||||
- name: test gather hcloud volume infos with correct label selector
|
||||
hcloud_volume_info:
|
||||
|
|
Loading…
Reference in a new issue