簡體   English   中英

選擇計算節點(管理程序)以使用 ansible openstack.cloud.server 模塊創建實例

[英]Choose compute node(hypervisor) for instance creation with ansible openstack.cloud.server module

我希望在使用 Openstack ansible 模塊openstack.cloud.server創建實例時指定要駐留在哪個計算節點上,實際上我想 ansiblealize 以下命令:

$ openstack server create --flavor g2 --image Ubuntu-20.04 --network public2 --security-group default --hypervisor-hostname compute3 --os-compute-api-version 2.74 test
# OR
$ openstack server create --flavor g2 --image Ubuntu-20.04 --network public2 --security-group default --host compute3 --os-compute-api-version 2.74 test

我如何將類似於 Openstack CLI 的--host--hypervisor-hostname傳遞給 ansible 中的openstack.cloud.server模塊???

嘗試使用meta hostname定義你的管理程序:

- name: Create a new instance and attaches to a network and passes metadata to the instance
  openstack.cloud.server:
      ......
      meta:
        hostname: test1

應作為元數據提供給新實例的鍵值對列表

另一種方式,它可以使用availability_zone參數到select 主機

- name: launch an instance in specific host
  openstack.cloud.server:
    ......
    availability_zone: nova:compute3001

另請參閱此示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM