当 ansible 设备对应特定 ID 名称时,我尝试安装磁盘:google-pgdata
"sdc": {
"holders": [],
"host": "",
"links": {
"ids": [
"google-pgdata",
"scsi-0Google_PersistentDisk_pgdata"
],
"labels": [],
"masters": [],
"uuids": []
},
"model": "PersistentDisk",
"partitions": {},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "noop",
"sectors": "209715200",
答案1
您可以通过引用 ansible 事实的 id 来检索磁盘数据:
{{ ansible_facts['devices']['sdc']['ids'] }}
您可以在Ansible 剧本。
另外,要安装磁盘,您可以按照安装模块在 ansible 文档中。