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
|
type: int
|
||||||
returned: Always
|
returned: Always
|
||||||
sample: 1337
|
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:
|
location:
|
||||||
description: Location name where the volume is located at
|
description: Location name where the volume is located at
|
||||||
type: string
|
type: string
|
||||||
|
@ -178,6 +184,7 @@ class AnsibleHcloudVolume(Hcloud):
|
||||||
"location": to_native(self.hcloud_volume.location.name),
|
"location": to_native(self.hcloud_volume.location.name),
|
||||||
"labels": self.hcloud_volume.labels,
|
"labels": self.hcloud_volume.labels,
|
||||||
"server": to_native(server_name),
|
"server": to_native(server_name),
|
||||||
|
"linux_device": to_native(self.hcloud_volume.linux_device),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_volume(self):
|
def _get_volume(self):
|
||||||
|
|
|
@ -73,6 +73,12 @@ hcloud_volume_info:
|
||||||
returned: always
|
returned: always
|
||||||
type: str
|
type: str
|
||||||
sample: 10
|
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:
|
location:
|
||||||
description: Name of the location where the volume resides in
|
description: Name of the location where the volume resides in
|
||||||
returned: always
|
returned: always
|
||||||
|
@ -119,6 +125,7 @@ class AnsibleHcloudVolumeInfo(Hcloud):
|
||||||
"location": to_native(volume.location.name),
|
"location": to_native(volume.location.name),
|
||||||
"labels": volume.labels,
|
"labels": volume.labels,
|
||||||
"server": to_native(server_name),
|
"server": to_native(server_name),
|
||||||
|
"linux_device": to_native(volume.linux_device),
|
||||||
})
|
})
|
||||||
|
|
||||||
return tmp
|
return tmp
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
- volume.hcloud_volume.location == "fsn1"
|
- volume.hcloud_volume.location == "fsn1"
|
||||||
- volume.hcloud_volume.size == 10
|
- volume.hcloud_volume.size == 10
|
||||||
- volume.hcloud_volume.server != "{{hcloud_server_name}}"
|
- volume.hcloud_volume.server != "{{hcloud_server_name}}"
|
||||||
|
- volume.hcloud_volume.linux_device is defined
|
||||||
|
|
||||||
- name: test create volume idempotence
|
- name: test create volume idempotence
|
||||||
hcloud_volume:
|
hcloud_volume:
|
||||||
|
|
|
@ -26,9 +26,15 @@
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
|
||||||
- name: verify test gather hcloud volume infos in check mode
|
- 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:
|
assert:
|
||||||
that:
|
that:
|
||||||
- hcloud_volume.hcloud_volume_info|selectattr('name','equalto','{{ hcloud_volume_name }}') | list | count == 1
|
- 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
|
- name: test gather hcloud volume infos with correct label selector
|
||||||
hcloud_volume_info:
|
hcloud_volume_info:
|
||||||
|
|
Loading…
Reference in a new issue